@tomflow/proflow-task-migration-runner 0.1.0 → 0.1.2
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.
- package/CHANGELOG.md +13 -0
- package/dist/deployment/adapter.d.ts +337 -37
- package/dist/deployment/adapter.js +144 -24
- package/dist/deployment/descriptor.d.ts +1 -1
- package/dist/deployment/descriptor.js +1 -1
- package/dist/src/cli.js +2 -1
- package/package.json +3 -3
- package/proflow.module.json +1 -1
- package/self-install.mjs +12 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @tomflow/proflow-task-migration-runner
|
|
2
|
+
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Real-1 final remediation and black-box release closure
|
|
8
|
+
|
|
9
|
+
## 0.1.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Close the Real-1 global Platform control-plane contract across every published ProFlow package. Platform CLI now owns one durable global Workspace binding with canonical identity, cross-process operation locking, cwd/`--workspace` install targeting, cross-directory instance commands, whole-instance uninstall/rebind, and deterministic npm/yarn/pnpm Workspace package-manager selection. Every package-owned install entry, including newly generated Module Template packages, delegates to the Shell-global `platform` command and fails closed when that global CLI is unavailable; Deployment Conformance and the formal test plans mechanically enforce the same rule across all 24 packages.
|
|
@@ -1,67 +1,367 @@
|
|
|
1
|
+
export declare function createBehaviorAdapter(config?: Record<string, string>): {
|
|
2
|
+
describe: () => {
|
|
3
|
+
result: {
|
|
4
|
+
contract: "deployment.result.v1";
|
|
5
|
+
moduleRef: "task-migration-runner";
|
|
6
|
+
moduleVersion: "0.1.2";
|
|
7
|
+
ok: boolean;
|
|
8
|
+
status: "SUCCEEDED";
|
|
9
|
+
data?: {} | null;
|
|
10
|
+
checks?: unknown[];
|
|
11
|
+
};
|
|
12
|
+
observedEffects: never[];
|
|
13
|
+
};
|
|
14
|
+
preflight: () => {
|
|
15
|
+
result: {
|
|
16
|
+
contract: "deployment.result.v1";
|
|
17
|
+
moduleRef: "task-migration-runner";
|
|
18
|
+
moduleVersion: "0.1.2";
|
|
19
|
+
ok: boolean;
|
|
20
|
+
status: "SUCCEEDED";
|
|
21
|
+
data?: {} | null;
|
|
22
|
+
checks?: unknown[];
|
|
23
|
+
} | {
|
|
24
|
+
contract: "deployment.result.v1";
|
|
25
|
+
moduleRef: "task-migration-runner";
|
|
26
|
+
moduleVersion: "0.1.2";
|
|
27
|
+
ok: boolean;
|
|
28
|
+
status: "ACTION_REQUIRED";
|
|
29
|
+
actionRequired: {
|
|
30
|
+
action: string;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
data?: {} | null;
|
|
34
|
+
checks?: unknown[];
|
|
35
|
+
};
|
|
36
|
+
observedEffects: never[];
|
|
37
|
+
};
|
|
38
|
+
status: () => {
|
|
39
|
+
result: {
|
|
40
|
+
contract: "deployment.result.v1";
|
|
41
|
+
moduleRef: "task-migration-runner";
|
|
42
|
+
moduleVersion: "0.1.2";
|
|
43
|
+
ok: boolean;
|
|
44
|
+
status: "SUCCEEDED";
|
|
45
|
+
data?: {} | null;
|
|
46
|
+
checks?: unknown[];
|
|
47
|
+
} | {
|
|
48
|
+
contract: "deployment.result.v1";
|
|
49
|
+
moduleRef: "task-migration-runner";
|
|
50
|
+
moduleVersion: "0.1.2";
|
|
51
|
+
ok: boolean;
|
|
52
|
+
status: "ACTION_REQUIRED";
|
|
53
|
+
actionRequired: {
|
|
54
|
+
action: string;
|
|
55
|
+
description: string;
|
|
56
|
+
};
|
|
57
|
+
data?: {} | null;
|
|
58
|
+
checks?: unknown[];
|
|
59
|
+
};
|
|
60
|
+
observedEffects: never[];
|
|
61
|
+
};
|
|
62
|
+
verify: () => {
|
|
63
|
+
result: {
|
|
64
|
+
contract: "deployment.result.v1";
|
|
65
|
+
moduleRef: "task-migration-runner";
|
|
66
|
+
moduleVersion: "0.1.2";
|
|
67
|
+
ok: boolean;
|
|
68
|
+
status: "ACTION_REQUIRED";
|
|
69
|
+
actionRequired: {
|
|
70
|
+
action: string;
|
|
71
|
+
description: string;
|
|
72
|
+
};
|
|
73
|
+
data?: {} | null;
|
|
74
|
+
checks?: unknown[];
|
|
75
|
+
};
|
|
76
|
+
observedEffects: never[];
|
|
77
|
+
} | {
|
|
78
|
+
result: {
|
|
79
|
+
contract: "deployment.result.v1";
|
|
80
|
+
moduleRef: "task-migration-runner";
|
|
81
|
+
moduleVersion: "0.1.2";
|
|
82
|
+
ok: boolean;
|
|
83
|
+
status: "SUCCEEDED";
|
|
84
|
+
data?: {} | null;
|
|
85
|
+
checks?: unknown[];
|
|
86
|
+
} | {
|
|
87
|
+
contract: "deployment.result.v1";
|
|
88
|
+
moduleRef: "task-migration-runner";
|
|
89
|
+
moduleVersion: "0.1.2";
|
|
90
|
+
ok: boolean;
|
|
91
|
+
status: "FAILED";
|
|
92
|
+
error: {
|
|
93
|
+
code: "APPLY_FAILED" | "VERIFY_FAILED";
|
|
94
|
+
message: string;
|
|
95
|
+
retryable: boolean;
|
|
96
|
+
};
|
|
97
|
+
data?: {} | null;
|
|
98
|
+
checks?: unknown[];
|
|
99
|
+
};
|
|
100
|
+
observedEffects: never[];
|
|
101
|
+
};
|
|
102
|
+
doctor: () => {
|
|
103
|
+
result: {
|
|
104
|
+
contract: "deployment.result.v1";
|
|
105
|
+
moduleRef: "task-migration-runner";
|
|
106
|
+
moduleVersion: "0.1.2";
|
|
107
|
+
ok: boolean;
|
|
108
|
+
status: "ACTION_REQUIRED";
|
|
109
|
+
actionRequired: {
|
|
110
|
+
action: string;
|
|
111
|
+
description: string;
|
|
112
|
+
};
|
|
113
|
+
data?: {} | null;
|
|
114
|
+
checks?: unknown[];
|
|
115
|
+
};
|
|
116
|
+
observedEffects: never[];
|
|
117
|
+
} | {
|
|
118
|
+
result: {
|
|
119
|
+
contract: "deployment.result.v1";
|
|
120
|
+
moduleRef: "task-migration-runner";
|
|
121
|
+
moduleVersion: "0.1.2";
|
|
122
|
+
ok: boolean;
|
|
123
|
+
status: "SUCCEEDED";
|
|
124
|
+
data?: {} | null;
|
|
125
|
+
checks?: unknown[];
|
|
126
|
+
} | {
|
|
127
|
+
contract: "deployment.result.v1";
|
|
128
|
+
moduleRef: "task-migration-runner";
|
|
129
|
+
moduleVersion: "0.1.2";
|
|
130
|
+
ok: boolean;
|
|
131
|
+
status: "BLOCKED";
|
|
132
|
+
error: {
|
|
133
|
+
code: "VERIFY_FAILED";
|
|
134
|
+
message: string;
|
|
135
|
+
retryable: boolean;
|
|
136
|
+
};
|
|
137
|
+
data?: {} | null;
|
|
138
|
+
};
|
|
139
|
+
observedEffects: never[];
|
|
140
|
+
};
|
|
141
|
+
migrate: () => {
|
|
142
|
+
result: {
|
|
143
|
+
contract: "deployment.result.v1";
|
|
144
|
+
moduleRef: "task-migration-runner";
|
|
145
|
+
moduleVersion: "0.1.2";
|
|
146
|
+
ok: boolean;
|
|
147
|
+
status: "ACTION_REQUIRED";
|
|
148
|
+
actionRequired: {
|
|
149
|
+
action: string;
|
|
150
|
+
description: string;
|
|
151
|
+
};
|
|
152
|
+
data?: {} | null;
|
|
153
|
+
checks?: unknown[];
|
|
154
|
+
};
|
|
155
|
+
observedEffects: never[];
|
|
156
|
+
} | {
|
|
157
|
+
result: {
|
|
158
|
+
contract: "deployment.result.v1";
|
|
159
|
+
moduleRef: "task-migration-runner";
|
|
160
|
+
moduleVersion: "0.1.2";
|
|
161
|
+
ok: boolean;
|
|
162
|
+
status: "SUCCEEDED";
|
|
163
|
+
data?: {} | null;
|
|
164
|
+
checks?: unknown[];
|
|
165
|
+
} | {
|
|
166
|
+
contract: "deployment.result.v1";
|
|
167
|
+
moduleRef: "task-migration-runner";
|
|
168
|
+
moduleVersion: "0.1.2";
|
|
169
|
+
ok: boolean;
|
|
170
|
+
status: "FAILED";
|
|
171
|
+
error: {
|
|
172
|
+
code: "APPLY_FAILED" | "VERIFY_FAILED";
|
|
173
|
+
message: string;
|
|
174
|
+
retryable: boolean;
|
|
175
|
+
};
|
|
176
|
+
data?: {} | null;
|
|
177
|
+
checks?: unknown[];
|
|
178
|
+
};
|
|
179
|
+
observedEffects: string[];
|
|
180
|
+
};
|
|
181
|
+
};
|
|
1
182
|
export declare const behaviorAdapter: {
|
|
2
|
-
|
|
183
|
+
describe: () => {
|
|
3
184
|
result: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
185
|
+
contract: "deployment.result.v1";
|
|
186
|
+
moduleRef: "task-migration-runner";
|
|
187
|
+
moduleVersion: "0.1.2";
|
|
188
|
+
ok: boolean;
|
|
189
|
+
status: "SUCCEEDED";
|
|
190
|
+
data?: {} | null;
|
|
191
|
+
checks?: unknown[];
|
|
9
192
|
};
|
|
10
193
|
observedEffects: never[];
|
|
11
194
|
};
|
|
12
|
-
|
|
195
|
+
preflight: () => {
|
|
13
196
|
result: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
197
|
+
contract: "deployment.result.v1";
|
|
198
|
+
moduleRef: "task-migration-runner";
|
|
199
|
+
moduleVersion: "0.1.2";
|
|
200
|
+
ok: boolean;
|
|
201
|
+
status: "SUCCEEDED";
|
|
202
|
+
data?: {} | null;
|
|
203
|
+
checks?: unknown[];
|
|
204
|
+
} | {
|
|
205
|
+
contract: "deployment.result.v1";
|
|
206
|
+
moduleRef: "task-migration-runner";
|
|
207
|
+
moduleVersion: "0.1.2";
|
|
208
|
+
ok: boolean;
|
|
209
|
+
status: "ACTION_REQUIRED";
|
|
210
|
+
actionRequired: {
|
|
211
|
+
action: string;
|
|
212
|
+
description: string;
|
|
213
|
+
};
|
|
214
|
+
data?: {} | null;
|
|
215
|
+
checks?: unknown[];
|
|
19
216
|
};
|
|
20
217
|
observedEffects: never[];
|
|
21
218
|
};
|
|
22
|
-
|
|
219
|
+
status: () => {
|
|
23
220
|
result: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
221
|
+
contract: "deployment.result.v1";
|
|
222
|
+
moduleRef: "task-migration-runner";
|
|
223
|
+
moduleVersion: "0.1.2";
|
|
224
|
+
ok: boolean;
|
|
225
|
+
status: "SUCCEEDED";
|
|
226
|
+
data?: {} | null;
|
|
227
|
+
checks?: unknown[];
|
|
228
|
+
} | {
|
|
229
|
+
contract: "deployment.result.v1";
|
|
230
|
+
moduleRef: "task-migration-runner";
|
|
231
|
+
moduleVersion: "0.1.2";
|
|
232
|
+
ok: boolean;
|
|
233
|
+
status: "ACTION_REQUIRED";
|
|
234
|
+
actionRequired: {
|
|
235
|
+
action: string;
|
|
236
|
+
description: string;
|
|
237
|
+
};
|
|
238
|
+
data?: {} | null;
|
|
239
|
+
checks?: unknown[];
|
|
29
240
|
};
|
|
30
241
|
observedEffects: never[];
|
|
31
242
|
};
|
|
32
|
-
|
|
243
|
+
verify: () => {
|
|
33
244
|
result: {
|
|
34
245
|
contract: "deployment.result.v1";
|
|
35
|
-
|
|
246
|
+
moduleRef: "task-migration-runner";
|
|
247
|
+
moduleVersion: "0.1.2";
|
|
248
|
+
ok: boolean;
|
|
249
|
+
status: "ACTION_REQUIRED";
|
|
250
|
+
actionRequired: {
|
|
251
|
+
action: string;
|
|
252
|
+
description: string;
|
|
253
|
+
};
|
|
254
|
+
data?: {} | null;
|
|
255
|
+
checks?: unknown[];
|
|
256
|
+
};
|
|
257
|
+
observedEffects: never[];
|
|
258
|
+
} | {
|
|
259
|
+
result: {
|
|
260
|
+
contract: "deployment.result.v1";
|
|
261
|
+
moduleRef: "task-migration-runner";
|
|
262
|
+
moduleVersion: "0.1.2";
|
|
263
|
+
ok: boolean;
|
|
36
264
|
status: "SUCCEEDED";
|
|
265
|
+
data?: {} | null;
|
|
266
|
+
checks?: unknown[];
|
|
267
|
+
} | {
|
|
268
|
+
contract: "deployment.result.v1";
|
|
37
269
|
moduleRef: "task-migration-runner";
|
|
38
|
-
moduleVersion: "0.1.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
270
|
+
moduleVersion: "0.1.2";
|
|
271
|
+
ok: boolean;
|
|
272
|
+
status: "FAILED";
|
|
273
|
+
error: {
|
|
274
|
+
code: "APPLY_FAILED" | "VERIFY_FAILED";
|
|
42
275
|
message: string;
|
|
43
|
-
|
|
276
|
+
retryable: boolean;
|
|
277
|
+
};
|
|
278
|
+
data?: {} | null;
|
|
279
|
+
checks?: unknown[];
|
|
44
280
|
};
|
|
45
281
|
observedEffects: never[];
|
|
46
282
|
};
|
|
47
|
-
|
|
283
|
+
doctor: () => {
|
|
284
|
+
result: {
|
|
285
|
+
contract: "deployment.result.v1";
|
|
286
|
+
moduleRef: "task-migration-runner";
|
|
287
|
+
moduleVersion: "0.1.2";
|
|
288
|
+
ok: boolean;
|
|
289
|
+
status: "ACTION_REQUIRED";
|
|
290
|
+
actionRequired: {
|
|
291
|
+
action: string;
|
|
292
|
+
description: string;
|
|
293
|
+
};
|
|
294
|
+
data?: {} | null;
|
|
295
|
+
checks?: unknown[];
|
|
296
|
+
};
|
|
297
|
+
observedEffects: never[];
|
|
298
|
+
} | {
|
|
48
299
|
result: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
300
|
+
contract: "deployment.result.v1";
|
|
301
|
+
moduleRef: "task-migration-runner";
|
|
302
|
+
moduleVersion: "0.1.2";
|
|
303
|
+
ok: boolean;
|
|
304
|
+
status: "SUCCEEDED";
|
|
305
|
+
data?: {} | null;
|
|
306
|
+
checks?: unknown[];
|
|
307
|
+
} | {
|
|
308
|
+
contract: "deployment.result.v1";
|
|
309
|
+
moduleRef: "task-migration-runner";
|
|
310
|
+
moduleVersion: "0.1.2";
|
|
311
|
+
ok: boolean;
|
|
312
|
+
status: "BLOCKED";
|
|
313
|
+
error: {
|
|
314
|
+
code: "VERIFY_FAILED";
|
|
315
|
+
message: string;
|
|
316
|
+
retryable: boolean;
|
|
317
|
+
};
|
|
318
|
+
data?: {} | null;
|
|
54
319
|
};
|
|
55
320
|
observedEffects: never[];
|
|
56
321
|
};
|
|
57
|
-
|
|
322
|
+
migrate: () => {
|
|
323
|
+
result: {
|
|
324
|
+
contract: "deployment.result.v1";
|
|
325
|
+
moduleRef: "task-migration-runner";
|
|
326
|
+
moduleVersion: "0.1.2";
|
|
327
|
+
ok: boolean;
|
|
328
|
+
status: "ACTION_REQUIRED";
|
|
329
|
+
actionRequired: {
|
|
330
|
+
action: string;
|
|
331
|
+
description: string;
|
|
332
|
+
};
|
|
333
|
+
data?: {} | null;
|
|
334
|
+
checks?: unknown[];
|
|
335
|
+
};
|
|
336
|
+
observedEffects: never[];
|
|
337
|
+
} | {
|
|
58
338
|
result: {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
339
|
+
contract: "deployment.result.v1";
|
|
340
|
+
moduleRef: "task-migration-runner";
|
|
341
|
+
moduleVersion: "0.1.2";
|
|
342
|
+
ok: boolean;
|
|
343
|
+
status: "SUCCEEDED";
|
|
344
|
+
data?: {} | null;
|
|
345
|
+
checks?: unknown[];
|
|
346
|
+
} | {
|
|
347
|
+
contract: "deployment.result.v1";
|
|
348
|
+
moduleRef: "task-migration-runner";
|
|
349
|
+
moduleVersion: "0.1.2";
|
|
350
|
+
ok: boolean;
|
|
351
|
+
status: "FAILED";
|
|
352
|
+
error: {
|
|
353
|
+
code: "APPLY_FAILED" | "VERIFY_FAILED";
|
|
354
|
+
message: string;
|
|
355
|
+
retryable: boolean;
|
|
356
|
+
};
|
|
357
|
+
data?: {} | null;
|
|
358
|
+
checks?: unknown[];
|
|
64
359
|
};
|
|
65
360
|
observedEffects: string[];
|
|
66
361
|
};
|
|
67
362
|
};
|
|
363
|
+
export declare function createProductionBinding(input: {
|
|
364
|
+
config: Record<string, string>;
|
|
365
|
+
}): {
|
|
366
|
+
behaviorAdapter: Record<string, unknown>;
|
|
367
|
+
};
|
|
@@ -1,31 +1,151 @@
|
|
|
1
|
+
import { taskMigrations } from "@tomflow/proflow-task-store-sqlite/migrations";
|
|
2
|
+
import { applyMigrations, getMigrationStatus, verifyMigrations, } from "../src/index.js";
|
|
1
3
|
import { descriptor } from "./descriptor.js";
|
|
2
|
-
const
|
|
4
|
+
const base = {
|
|
3
5
|
contract: "deployment.result.v1",
|
|
4
|
-
ok: true,
|
|
5
|
-
status: "SUCCEEDED",
|
|
6
6
|
moduleRef: descriptor.moduleRef,
|
|
7
7
|
moduleVersion: descriptor.moduleVersion,
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
status:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const success = (data, checks) => ({
|
|
10
|
+
...base,
|
|
11
|
+
ok: true,
|
|
12
|
+
status: "SUCCEEDED",
|
|
13
|
+
...(data === undefined ? {} : { data }),
|
|
14
|
+
...(checks === undefined ? {} : { checks }),
|
|
15
|
+
});
|
|
16
|
+
const actionRequired = (description, data, checks) => ({
|
|
17
|
+
...base,
|
|
18
|
+
ok: false,
|
|
19
|
+
status: "ACTION_REQUIRED",
|
|
20
|
+
actionRequired: { action: "configure-task-migrations", description },
|
|
21
|
+
...(data === undefined ? {} : { data }),
|
|
22
|
+
...(checks === undefined ? {} : { checks }),
|
|
23
|
+
});
|
|
24
|
+
const failed = (message, data, checks, code = "APPLY_FAILED") => ({
|
|
25
|
+
...base,
|
|
26
|
+
ok: false,
|
|
27
|
+
status: "FAILED",
|
|
28
|
+
error: { code, message, retryable: false },
|
|
29
|
+
...(data === undefined ? {} : { data }),
|
|
30
|
+
...(checks === undefined ? {} : { checks }),
|
|
31
|
+
});
|
|
32
|
+
const blocked = (message, data) => ({
|
|
33
|
+
...base,
|
|
34
|
+
ok: false,
|
|
35
|
+
status: "BLOCKED",
|
|
36
|
+
error: { code: "VERIFY_FAILED", message, retryable: true },
|
|
37
|
+
...(data === undefined ? {} : { data }),
|
|
38
|
+
});
|
|
39
|
+
function migrationInput(config) {
|
|
40
|
+
const databasePath = config.databasePath;
|
|
41
|
+
if (!databasePath)
|
|
42
|
+
return undefined;
|
|
43
|
+
return { databasePath, migrations: taskMigrations };
|
|
44
|
+
}
|
|
45
|
+
function statusData(config) {
|
|
46
|
+
const input = migrationInput(config);
|
|
47
|
+
if (input === undefined)
|
|
48
|
+
return undefined;
|
|
49
|
+
const status = getMigrationStatus(input);
|
|
50
|
+
const verification = verifyMigrations(input);
|
|
51
|
+
return {
|
|
52
|
+
migrated: verification.ok,
|
|
53
|
+
appliedVersions: status.appliedVersions,
|
|
54
|
+
pendingVersions: status.pendingVersions,
|
|
55
|
+
metadataDrift: status.metadataDrift,
|
|
56
|
+
checksumDrift: status.checksumDrift,
|
|
57
|
+
legacyMetadataVersions: status.legacyMetadataVersions,
|
|
58
|
+
missingTables: status.missingTables,
|
|
59
|
+
schemaDrift: status.schemaDrift,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export function createBehaviorAdapter(config = {}) {
|
|
63
|
+
return {
|
|
64
|
+
describe: () => ({ result: success(), observedEffects: [] }),
|
|
65
|
+
preflight: () => ({
|
|
66
|
+
result: migrationInput(config) === undefined
|
|
67
|
+
? actionRequired("databasePath is required for Task migrations")
|
|
68
|
+
: success(),
|
|
69
|
+
observedEffects: [],
|
|
70
|
+
}),
|
|
71
|
+
status: () => {
|
|
72
|
+
const data = statusData(config);
|
|
73
|
+
return {
|
|
74
|
+
result: data === undefined
|
|
75
|
+
? actionRequired("databasePath is required for Task migration status")
|
|
76
|
+
: success(data),
|
|
77
|
+
observedEffects: [],
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
verify: () => {
|
|
81
|
+
const input = migrationInput(config);
|
|
82
|
+
if (input === undefined) {
|
|
83
|
+
const check = {
|
|
18
84
|
id: "migration-state-pass",
|
|
19
|
-
status: "
|
|
20
|
-
message: "
|
|
21
|
-
}
|
|
22
|
-
|
|
85
|
+
status: "FAIL",
|
|
86
|
+
message: "databasePath is required for Task migration verification",
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
result: actionRequired(check.message, undefined, [check]),
|
|
90
|
+
observedEffects: [],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const verification = verifyMigrations(input);
|
|
94
|
+
const data = statusData(config);
|
|
95
|
+
const check = {
|
|
96
|
+
id: "migration-state-pass",
|
|
97
|
+
status: verification.ok ? "PASS" : "FAIL",
|
|
98
|
+
message: verification.ok
|
|
99
|
+
? "Task migration state and SQLite integrity match the current schema"
|
|
100
|
+
: (verification.error?.message ??
|
|
101
|
+
"Task migration verification failed"),
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
result: verification.ok
|
|
105
|
+
? success(data, [check])
|
|
106
|
+
: failed(check.message, data, [check], "VERIFY_FAILED"),
|
|
107
|
+
observedEffects: [],
|
|
108
|
+
};
|
|
23
109
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
110
|
+
doctor: () => {
|
|
111
|
+
const data = statusData(config);
|
|
112
|
+
if (data === undefined) {
|
|
113
|
+
return {
|
|
114
|
+
result: actionRequired("databasePath is required for Task migration diagnostics"),
|
|
115
|
+
observedEffects: [],
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
result: data.migrated
|
|
120
|
+
? success(data)
|
|
121
|
+
: blocked("Task migration state requires a repair/migration plan before readiness", data),
|
|
122
|
+
observedEffects: [],
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
migrate: () => {
|
|
126
|
+
const input = migrationInput(config);
|
|
127
|
+
if (input === undefined) {
|
|
128
|
+
return {
|
|
129
|
+
result: actionRequired("databasePath is required before Task migrations can run"),
|
|
130
|
+
observedEffects: [],
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const migration = applyMigrations(input);
|
|
134
|
+
return {
|
|
135
|
+
result: migration.ok
|
|
136
|
+
? success({ applied: migration.applied, pending: migration.pending })
|
|
137
|
+
: failed(migration.error?.message ?? "Task migration failed", {
|
|
138
|
+
applied: migration.applied,
|
|
139
|
+
pending: migration.pending,
|
|
140
|
+
}),
|
|
141
|
+
observedEffects: migration.ok
|
|
142
|
+
? ["Applies Task Store migration SQL to SQLite"]
|
|
143
|
+
: [],
|
|
144
|
+
};
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
export const behaviorAdapter = createBehaviorAdapter();
|
|
149
|
+
export function createProductionBinding(input) {
|
|
150
|
+
return { behaviorAdapter: createBehaviorAdapter(input.config) };
|
|
151
|
+
}
|
|
@@ -3,7 +3,7 @@ export declare const descriptor: {
|
|
|
3
3
|
readonly contractVersion: "1.0.0";
|
|
4
4
|
readonly moduleRef: "task-migration-runner";
|
|
5
5
|
readonly packageName: "@tomflow/proflow-task-migration-runner";
|
|
6
|
-
readonly moduleVersion: "0.1.
|
|
6
|
+
readonly moduleVersion: "0.1.2";
|
|
7
7
|
readonly kind: "cli";
|
|
8
8
|
readonly templateVersion: "1.0.0";
|
|
9
9
|
readonly platformCompatibility: ">=1.0.0 <2.0.0";
|
|
@@ -3,7 +3,7 @@ export const descriptor = {
|
|
|
3
3
|
contractVersion: "1.0.0",
|
|
4
4
|
moduleRef: "task-migration-runner",
|
|
5
5
|
packageName: "@tomflow/proflow-task-migration-runner",
|
|
6
|
-
moduleVersion: "0.1.
|
|
6
|
+
moduleVersion: "0.1.2",
|
|
7
7
|
kind: "cli",
|
|
8
8
|
templateVersion: "1.0.0",
|
|
9
9
|
platformCompatibility: ">=1.0.0 <2.0.0",
|
package/dist/src/cli.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
2
3
|
import { pathToFileURL } from "node:url";
|
|
3
4
|
import { runCli } from "./index.js";
|
|
4
5
|
export { runCli } from "./index.js";
|
|
5
6
|
if (process.argv[1] !== undefined &&
|
|
6
|
-
import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
7
|
+
import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href) {
|
|
7
8
|
const output = await runCli(process.argv.slice(2));
|
|
8
9
|
process.stdout.write(`${output}\n`);
|
|
9
10
|
if (JSON.parse(output).ok !== true)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomflow/proflow-task-migration-runner",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"self-install.mjs"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@tomflow/proflow-task-store-sqlite": "^0.1.
|
|
27
|
-
"@tomflow/proflow-module-contract": "^0.1.
|
|
26
|
+
"@tomflow/proflow-task-store-sqlite": "^0.1.2",
|
|
27
|
+
"@tomflow/proflow-module-contract": "^0.1.1"
|
|
28
28
|
},
|
|
29
29
|
"description": "Deterministically discovers, applies and verifies Task Store SQLite schema migrations.",
|
|
30
30
|
"keywords": [
|
package/proflow.module.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"contractVersion": "1.0.0",
|
|
4
4
|
"moduleRef": "task-migration-runner",
|
|
5
5
|
"packageName": "@tomflow/proflow-task-migration-runner",
|
|
6
|
-
"moduleVersion": "0.1.
|
|
6
|
+
"moduleVersion": "0.1.2",
|
|
7
7
|
"kind": "cli",
|
|
8
8
|
"templateVersion": "1.0.0",
|
|
9
9
|
"platformCompatibility": ">=1.0.0 <2.0.0",
|
package/self-install.mjs
CHANGED
|
@@ -11,16 +11,24 @@ if (command !== "install" || rest.length > 0) {
|
|
|
11
11
|
process.stderr.write(usage);
|
|
12
12
|
process.exit(2);
|
|
13
13
|
}
|
|
14
|
-
const executable = process.platform === "win32" ? "
|
|
14
|
+
const executable = process.platform === "win32" ? "platform.cmd" : "platform";
|
|
15
15
|
const result = spawnSync(
|
|
16
16
|
executable,
|
|
17
17
|
[
|
|
18
|
-
"--yes",
|
|
19
|
-
"@tomflow/proflow-platform-cli",
|
|
20
18
|
"install",
|
|
21
19
|
"@tomflow/proflow-task-migration-runner",
|
|
20
|
+
"--workspace",
|
|
21
|
+
process.cwd(),
|
|
22
22
|
],
|
|
23
23
|
{ cwd: process.cwd(), env: process.env, stdio: "inherit" },
|
|
24
24
|
);
|
|
25
|
-
if (result.error)
|
|
25
|
+
if (result.error) {
|
|
26
|
+
if (result.error.code === "ENOENT") {
|
|
27
|
+
process.stderr.write(
|
|
28
|
+
"GLOBAL_PLATFORM_CLI_REQUIRED: install @tomflow/proflow-platform-cli globally before package-owned install\n",
|
|
29
|
+
);
|
|
30
|
+
process.exit(127);
|
|
31
|
+
}
|
|
32
|
+
throw result.error;
|
|
33
|
+
}
|
|
26
34
|
process.exit(result.status ?? 1);
|