@treeseed/sdk 0.4.6 → 0.4.8

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.
@@ -1,6 +1,8 @@
1
+ import { checkTreeseedProviderConnections } from '../operations/services/config-runtime.ts';
1
2
  import { resolveTreeseedWorkflowState } from '../workflow-state.ts';
2
- import type { TreeseedCloseInput, TreeseedConfigInput, TreeseedDestroyInput, TreeseedReleaseInput, TreeseedSaveInput, TreeseedStageInput, TreeseedSwitchInput, TreeseedTaskBranchMetadata, TreeseedWorkflowContext, TreeseedWorkflowDevInput, TreeseedWorkflowNextStep, TreeseedWorkflowOperationId, TreeseedWorkflowResult } from '../workflow.ts';
3
+ import type { TreeseedCloseInput, TreeseedConfigInput, TreeseedDestroyInput, TreeseedExportInput, TreeseedReleaseInput, TreeseedSaveInput, TreeseedStageInput, TreeseedSwitchInput, TreeseedTaskBranchMetadata, TreeseedWorkflowContext, TreeseedWorkflowDevInput, TreeseedWorkflowNextStep, TreeseedWorkflowOperationId, TreeseedWorkflowResult } from '../workflow.ts';
3
4
  type WorkflowWrite = NonNullable<TreeseedWorkflowContext['write']>;
5
+ type WorkflowStatePayload = ReturnType<typeof resolveTreeseedWorkflowState>;
4
6
  export type TreeseedWorkflowErrorCode = 'validation_failed' | 'merge_conflict' | 'missing_runtime_auth' | 'deployment_timeout' | 'confirmation_required' | 'unsupported_transport' | 'unsupported_state';
5
7
  export declare class TreeseedWorkflowError extends Error {
6
8
  code: TreeseedWorkflowErrorCode;
@@ -21,77 +23,136 @@ export type WorkflowOperationHelpers = {
21
23
  tasks: TreeseedTaskBranchMetadata[];
22
24
  }>>;
23
25
  };
24
- type TreeseedRepairAction = {
25
- id: string;
26
- detail: string;
27
- };
28
26
  export declare function workflowStatus(helpers: WorkflowOperationHelpers): Promise<TreeseedWorkflowResult<import("../workflow-state.ts").TreeseedWorkflowState>>;
29
27
  export declare function workflowTasks(helpers: WorkflowOperationHelpers): Promise<TreeseedWorkflowResult<{
30
28
  tasks: TreeseedTaskBranchMetadata[];
31
29
  }>>;
32
- export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?: TreeseedConfigInput): Promise<{
33
- ok: true;
34
- operation: "config";
35
- payload: {
36
- mode: string;
30
+ export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?: TreeseedConfigInput): Promise<TreeseedWorkflowResult<{
31
+ mode: string;
32
+ scopes: ("local" | "staging" | "prod")[];
33
+ sync: "all" | "cloudflare" | "railway" | "none" | "github";
34
+ configPath: string;
35
+ keyPath: string;
36
+ repairs: import("../operations/services/config-runtime.ts").TreeseedRepairAction[];
37
+ preflight: {
38
+ ok: boolean;
39
+ requireAuth: boolean;
40
+ missingCommands: string[];
41
+ failingAuth: string[];
42
+ checks: {
43
+ commands: {
44
+ [k: string]: {
45
+ installed: boolean;
46
+ path: string | null;
47
+ };
48
+ };
49
+ auth: {};
50
+ };
51
+ };
52
+ toolHealth: {
53
+ githubCli: {
54
+ name: any;
55
+ available: any;
56
+ detail: any;
57
+ };
58
+ ghActExtension: {
59
+ name: any;
60
+ available: any;
61
+ detail: any;
62
+ };
63
+ dockerDaemon: {
64
+ name: any;
65
+ available: any;
66
+ detail: any;
67
+ };
68
+ actVerificationReady: any;
69
+ remediation: string[];
70
+ };
71
+ context: import("../operations/services/config-runtime.ts").TreeseedCollectedConfigContext;
72
+ result: {
37
73
  scopes: ("local" | "staging" | "prod")[];
38
- sync: "all" | "cloudflare" | "railway" | "none" | "github";
39
- secretsRevealed: boolean;
40
- reports: {
41
- scope: "local" | "staging" | "prod";
42
- environmentReport: string;
43
- providerReport: string;
74
+ synced: Record<string, unknown>;
75
+ initialized: Array<{
76
+ scope: import("../operations/services/config-runtime.ts").TreeseedConfigScope;
77
+ secrets: number;
78
+ target: string;
79
+ }>;
80
+ connectionChecks: ReturnType<typeof checkTreeseedProviderConnections>[];
81
+ validationByScope: Record<import("../operations/services/config-runtime.ts").TreeseedConfigScope, ReturnType<typeof import("../platform/environment.ts").validateTreeseedEnvironmentValues>>;
82
+ updated: {
83
+ scope: import("../operations/services/config-runtime.ts").TreeseedConfigScope | "shared";
84
+ id: string;
85
+ reused: boolean;
86
+ cleared: boolean;
44
87
  }[];
45
- repairs: TreeseedRepairAction[];
46
- preflight: {
88
+ envFiles: {
89
+ envLocalPath: string;
90
+ devVarsPath: string;
91
+ } | null;
92
+ };
93
+ reports: {
94
+ scope: "local" | "staging" | "prod";
95
+ environment: {
96
+ scope: "local" | "staging" | "prod";
97
+ revealSecrets: boolean;
98
+ entries: any;
99
+ };
100
+ provider: {
101
+ scope: string;
47
102
  ok: boolean;
48
- requireAuth: boolean;
49
- missingCommands: string[];
50
- failingAuth: string[];
51
103
  checks: {
52
- commands: {
53
- [k: string]: {
54
- installed: boolean;
55
- path: string | null;
56
- };
57
- };
58
- auth: {};
59
- };
60
- };
61
- toolHealth: {
62
- githubCli: {
63
- name: any;
64
- available: any;
65
- detail: any;
66
- };
67
- ghActExtension: {
68
- name: any;
69
- available: any;
70
- detail: any;
71
- };
72
- dockerDaemon: {
73
- name: any;
74
- available: any;
104
+ provider: any;
105
+ ready: any;
75
106
  detail: any;
76
- };
77
- actVerificationReady: any;
78
- remediation: string[];
107
+ }[];
108
+ };
109
+ }[];
110
+ state: import("../workflow-state.ts").TreeseedWorkflowState;
111
+ readiness: {
112
+ local: {
113
+ ready: boolean;
114
+ blockers: string[];
115
+ warnings: string[];
116
+ };
117
+ staging: {
118
+ ready: boolean;
119
+ blockers: string[];
120
+ warnings: string[];
121
+ };
122
+ prod: {
123
+ ready: boolean;
124
+ blockers: string[];
125
+ warnings: string[];
79
126
  };
80
- keyPath?: undefined;
81
- configPath?: undefined;
82
- result?: undefined;
83
- state?: undefined;
84
127
  };
85
- nextSteps: TreeseedWorkflowNextStep[];
86
- } | {
128
+ } & {
129
+ finalState: WorkflowStatePayload;
130
+ }> | {
87
131
  ok: true;
88
132
  operation: "config";
89
133
  payload: {
90
134
  mode: string;
91
135
  scopes: ("local" | "staging" | "prod")[];
92
136
  sync: "all" | "cloudflare" | "railway" | "none" | "github";
93
- keyPath: string;
94
- repairs: TreeseedRepairAction[];
137
+ secretsRevealed: boolean;
138
+ reports: {
139
+ scope: "local" | "staging" | "prod";
140
+ environment: {
141
+ scope: "local" | "staging" | "prod";
142
+ revealSecrets: boolean;
143
+ entries: any;
144
+ };
145
+ provider: {
146
+ scope: string;
147
+ ok: boolean;
148
+ checks: {
149
+ provider: any;
150
+ ready: any;
151
+ detail: any;
152
+ }[];
153
+ };
154
+ }[];
155
+ repairs: import("../operations/services/config-runtime.ts").TreeseedRepairAction[];
95
156
  preflight: {
96
157
  ok: boolean;
97
158
  requireAuth: boolean;
@@ -126,11 +187,7 @@ export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?
126
187
  actVerificationReady: any;
127
188
  remediation: string[];
128
189
  };
129
- secretsRevealed?: undefined;
130
- reports?: undefined;
131
- configPath?: undefined;
132
- result?: undefined;
133
- state?: undefined;
190
+ keyPath?: undefined;
134
191
  };
135
192
  nextSteps: TreeseedWorkflowNextStep[];
136
193
  } | {
@@ -140,9 +197,8 @@ export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?
140
197
  mode: string;
141
198
  scopes: ("local" | "staging" | "prod")[];
142
199
  sync: "all" | "cloudflare" | "railway" | "none" | "github";
143
- configPath: string;
144
200
  keyPath: string;
145
- repairs: TreeseedRepairAction[];
201
+ repairs: import("../operations/services/config-runtime.ts").TreeseedRepairAction[];
146
202
  preflight: {
147
203
  ok: boolean;
148
204
  requireAuth: boolean;
@@ -177,140 +233,200 @@ export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?
177
233
  actVerificationReady: any;
178
234
  remediation: string[];
179
235
  };
180
- result: {
181
- scopes: string[];
182
- updated: never[];
183
- synced: {};
184
- initialized: never[];
185
- connectionChecks: never[];
186
- };
187
- state: import("../workflow-state.ts").TreeseedWorkflowState;
188
236
  secretsRevealed?: undefined;
189
237
  reports?: undefined;
190
238
  };
191
239
  nextSteps: TreeseedWorkflowNextStep[];
192
240
  }>;
193
- export declare function workflowSwitch(helpers: WorkflowOperationHelpers, input: TreeseedSwitchInput): Promise<{
194
- ok: boolean;
195
- operation: string;
196
- payload: {
197
- branchName: string;
198
- created: boolean;
199
- resumed: boolean;
200
- previewRequested: boolean;
201
- preview: {
202
- enabled: boolean;
203
- url: string | null;
204
- lastDeploymentTimestamp: string | null;
205
- };
206
- previewResult: Record<string, unknown> | null;
207
- state: import("../workflow-state.ts").TreeseedWorkflowState;
241
+ export declare function workflowExport(helpers: WorkflowOperationHelpers, input?: TreeseedExportInput): Promise<TreeseedWorkflowResult<import("../operations/services/export-runtime.ts").TreeseedExportResult & {
242
+ finalState: WorkflowStatePayload;
243
+ }>>;
244
+ export declare function workflowSwitch(helpers: WorkflowOperationHelpers, input: TreeseedSwitchInput): Promise<TreeseedWorkflowResult<{
245
+ branchName: string;
246
+ created: boolean;
247
+ resumed: boolean;
248
+ previewRequested: boolean;
249
+ preview: {
250
+ enabled: boolean;
251
+ url: string | null;
252
+ lastDeploymentTimestamp: string | null;
208
253
  };
209
- nextSteps: TreeseedWorkflowNextStep[];
210
- }>;
211
- export declare function workflowDev(helpers: WorkflowOperationHelpers, input?: TreeseedWorkflowDevInput): Promise<{
212
- ok: true;
213
- operation: "dev";
214
- payload: {
215
- watch: boolean;
216
- background: boolean;
217
- command: string;
218
- args: string[];
219
- cwd: string;
220
- pid: number | null;
221
- exitCode: null;
254
+ previewResult: Record<string, unknown> | null;
255
+ preconditions: {
256
+ cleanWorktreeRequired: boolean;
257
+ baseBranch: string;
222
258
  };
223
- } | {
224
- ok: boolean;
225
- operation: "dev";
226
- payload: {
227
- watch: boolean;
228
- background: boolean;
229
- command: string;
230
- args: string[];
231
- cwd: string;
232
- pid: null;
233
- exitCode: number;
259
+ } & {
260
+ finalState: WorkflowStatePayload;
261
+ }>>;
262
+ export declare function workflowDev(helpers: WorkflowOperationHelpers, input?: TreeseedWorkflowDevInput): Promise<TreeseedWorkflowResult<{
263
+ watch: boolean;
264
+ background: boolean;
265
+ command: string;
266
+ args: string[];
267
+ cwd: string;
268
+ pid: number | null;
269
+ exitCode: null;
270
+ runtime: {
271
+ mode: string;
272
+ apiBaseUrl: string;
273
+ webUrl: string;
234
274
  };
235
- }>;
236
- export declare function workflowSave(helpers: WorkflowOperationHelpers, input: TreeseedSaveInput): Promise<{
237
- ok: boolean;
238
- operation: string;
239
- payload: {
275
+ readiness: {
276
+ ready: boolean;
277
+ blockers: string[];
278
+ warnings: string[];
279
+ };
280
+ } & {
281
+ finalState: WorkflowStatePayload;
282
+ }> | TreeseedWorkflowResult<{
283
+ watch: boolean;
284
+ background: boolean;
285
+ command: string;
286
+ args: string[];
287
+ cwd: string;
288
+ pid: null;
289
+ exitCode: number;
290
+ runtime: {
291
+ mode: string;
292
+ apiBaseUrl: string;
293
+ webUrl: string;
294
+ };
295
+ readiness: {
296
+ ready: boolean;
297
+ blockers: string[];
298
+ warnings: string[];
299
+ };
300
+ } & {
301
+ finalState: WorkflowStatePayload;
302
+ }>>;
303
+ export declare function workflowSave(helpers: WorkflowOperationHelpers, input: TreeseedSaveInput): Promise<TreeseedWorkflowResult<{
304
+ branch: string;
305
+ scope: string;
306
+ hotfix: boolean;
307
+ message: string;
308
+ commitSha: string;
309
+ commitCreated: boolean;
310
+ noChanges: boolean;
311
+ branchSync: {
312
+ remoteBranchExisted: boolean;
313
+ pulledRebase: boolean;
314
+ pushed: boolean;
315
+ createdRemoteBranch: boolean;
316
+ conflicts: boolean;
317
+ };
318
+ previewAction: Record<string, unknown>;
319
+ mergeConflict: null;
320
+ } & {
321
+ finalState: WorkflowStatePayload;
322
+ }>>;
323
+ export declare function workflowClose(helpers: WorkflowOperationHelpers, input: TreeseedCloseInput): Promise<TreeseedWorkflowResult<{
324
+ branchName: string;
325
+ message: string;
326
+ autoSaved: boolean;
327
+ autoSaveResult: ({
240
328
  branch: string;
241
329
  scope: string;
242
330
  hotfix: boolean;
243
331
  message: string;
244
332
  commitSha: string;
245
- previewRefresh: Record<string, unknown> | null;
246
- };
247
- nextSteps: TreeseedWorkflowNextStep[];
248
- }>;
249
- export declare function workflowClose(helpers: WorkflowOperationHelpers, input: TreeseedCloseInput): Promise<{
250
- ok: boolean;
251
- operation: string;
252
- payload: {
253
- branchName: string;
254
- message: string;
255
- deprecatedTag: {
256
- tagName: string;
257
- head: string;
258
- };
259
- previewCleanup: {
260
- performed: boolean;
261
- state: any;
262
- } | {
263
- performed: boolean;
333
+ commitCreated: boolean;
334
+ noChanges: boolean;
335
+ branchSync: {
336
+ remoteBranchExisted: boolean;
337
+ pulledRebase: boolean;
338
+ pushed: boolean;
339
+ createdRemoteBranch: boolean;
340
+ conflicts: boolean;
264
341
  };
265
- remoteDeleted: boolean;
266
- localDeleted: boolean;
342
+ previewAction: Record<string, unknown>;
343
+ mergeConflict: null;
344
+ } & {
345
+ finalState: WorkflowStatePayload;
346
+ }) | null;
347
+ deprecatedTag: {
348
+ tagName: string;
349
+ head: string;
267
350
  };
268
- nextSteps: TreeseedWorkflowNextStep[];
269
- }>;
270
- export declare function workflowStage(helpers: WorkflowOperationHelpers, input: TreeseedStageInput): Promise<{
271
- ok: boolean;
272
- operation: string;
273
- payload: {
274
- branchName: string;
275
- mergeTarget: string;
351
+ previewCleanup: {
352
+ performed: boolean;
353
+ state: any;
354
+ } | {
355
+ performed: boolean;
356
+ };
357
+ remoteDeleted: boolean;
358
+ localDeleted: boolean;
359
+ finalBranch: string;
360
+ } & {
361
+ finalState: WorkflowStatePayload;
362
+ }>>;
363
+ export declare function workflowStage(helpers: WorkflowOperationHelpers, input: TreeseedStageInput): Promise<TreeseedWorkflowResult<{
364
+ branchName: string;
365
+ mergeTarget: string;
366
+ message: string;
367
+ autoSaved: boolean;
368
+ autoSaveResult: ({
369
+ branch: string;
370
+ scope: string;
371
+ hotfix: boolean;
276
372
  message: string;
277
- deprecatedTag: {
278
- tagName: string;
279
- head: string;
280
- };
281
- stagingWait: {
282
- status: string;
283
- reason: string;
284
- branch?: undefined;
285
- } | {
286
- status: string;
287
- branch: string;
288
- reason?: undefined;
289
- };
290
- previewCleanup: {
291
- performed: boolean;
292
- state: any;
293
- } | {
294
- performed: boolean;
373
+ commitSha: string;
374
+ commitCreated: boolean;
375
+ noChanges: boolean;
376
+ branchSync: {
377
+ remoteBranchExisted: boolean;
378
+ pulledRebase: boolean;
379
+ pushed: boolean;
380
+ createdRemoteBranch: boolean;
381
+ conflicts: boolean;
295
382
  };
296
- remoteDeleted: boolean;
297
- localDeleted: boolean;
383
+ previewAction: Record<string, unknown>;
384
+ mergeConflict: null;
385
+ } & {
386
+ finalState: WorkflowStatePayload;
387
+ }) | null;
388
+ deprecatedTag: {
389
+ tagName: string;
390
+ head: string;
298
391
  };
299
- nextSteps: TreeseedWorkflowNextStep[];
300
- }>;
301
- export declare function workflowRelease(helpers: WorkflowOperationHelpers, input: TreeseedReleaseInput): Promise<{
302
- ok: boolean;
303
- operation: string;
304
- payload: {
305
- level: "patch" | "major" | "minor";
306
- rootVersion: string;
307
- releaseTag: string;
308
- stagingBranch: string;
309
- productionBranch: string;
310
- touchedPackages: unknown[];
392
+ stagingWait: {
393
+ status: string;
394
+ reason: string;
395
+ branch?: undefined;
396
+ } | {
397
+ status: string;
398
+ branch: string;
399
+ reason?: undefined;
311
400
  };
312
- nextSteps: TreeseedWorkflowNextStep[];
313
- }>;
401
+ previewCleanup: {
402
+ performed: boolean;
403
+ state: any;
404
+ } | {
405
+ performed: boolean;
406
+ };
407
+ remoteDeleted: boolean;
408
+ localDeleted: boolean;
409
+ finalBranch: string;
410
+ } & {
411
+ finalState: WorkflowStatePayload;
412
+ }>>;
413
+ export declare function workflowRelease(helpers: WorkflowOperationHelpers, input: TreeseedReleaseInput): Promise<TreeseedWorkflowResult<{
414
+ level: "patch" | "major" | "minor";
415
+ rootVersion: string;
416
+ releaseTag: string;
417
+ releasedCommit: string;
418
+ stagingBranch: string;
419
+ productionBranch: string;
420
+ touchedPackages: unknown[];
421
+ finalBranch: string;
422
+ pushStatus: {
423
+ stagingPushed: boolean;
424
+ productionPushed: boolean;
425
+ tagPushed: boolean;
426
+ };
427
+ } & {
428
+ finalState: WorkflowStatePayload;
429
+ }>>;
314
430
  export declare function workflowDestroy(helpers: WorkflowOperationHelpers, input: TreeseedDestroyInput): Promise<{
315
431
  ok: boolean;
316
432
  operation: string;