@tomflow/proflow-task-migration-runner 0.1.2 → 0.1.4
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/DOCS.md +27 -0
- package/SETUP.md +7 -0
- package/dist/deployment/adapter.d.ts +97 -301
- package/dist/deployment/adapter.js +108 -129
- package/dist/deployment/descriptor.d.ts +6 -23
- package/dist/deployment/descriptor.js +9 -35
- package/package.json +6 -11
- package/proflow.module.json +6 -36
- package/CHANGELOG.md +0 -13
- package/self-install.mjs +0 -34
package/DOCS.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @tomflow/proflow-task-migration-runner — Module Docs
|
|
2
|
+
|
|
3
|
+
Module ref: `task-migration-runner`
|
|
4
|
+
Domain: `task-orchestration`
|
|
5
|
+
Kind: `cli`
|
|
6
|
+
|
|
7
|
+
Deterministically discovers, applies and verifies Task Store SQLite schema migrations.
|
|
8
|
+
|
|
9
|
+
## Standard management surface
|
|
10
|
+
|
|
11
|
+
`install / uninstall / status / setup / docs / start / stop`
|
|
12
|
+
|
|
13
|
+
## Provides
|
|
14
|
+
|
|
15
|
+
- None.
|
|
16
|
+
|
|
17
|
+
## Requires
|
|
18
|
+
|
|
19
|
+
- None.
|
|
20
|
+
|
|
21
|
+
## Public setup inputs
|
|
22
|
+
|
|
23
|
+
- None. Deterministic/private values and cross-Module shared facts are not public configuration.
|
|
24
|
+
|
|
25
|
+
## Ownership boundary
|
|
26
|
+
|
|
27
|
+
Module business APIs and any module-specific extra commands remain package-owned. Platform does not proxy or interpret them. Current human/external preparation is documented in `SETUP.md`.
|
package/SETUP.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @tomflow/proflow-task-migration-runner — Module Setup
|
|
2
|
+
|
|
3
|
+
No user or external setup is required by the current frozen Module contract. `Module.install` completes deterministic preparation; `Module.setup` only re-observes current reality and must not ask the user to supply private paths, loopback endpoints, tokens or cross-Module facts.
|
|
4
|
+
|
|
5
|
+
## Completion
|
|
6
|
+
|
|
7
|
+
Setup is complete only when the Module's own `status` reports `setupStatus=READY`. Re-running setup must re-observe reality; it must not resume from a blind historical step index.
|
|
@@ -1,367 +1,163 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
} | {
|
|
1
|
+
import type { ModuleCommandContext } from "@tomflow/proflow-module-contract";
|
|
2
|
+
export declare const behaviorAdapter: {
|
|
3
|
+
readonly install: (context: ModuleCommandContext) => Promise<{
|
|
78
4
|
result: {
|
|
79
5
|
contract: "deployment.result.v1";
|
|
80
6
|
moduleRef: "task-migration-runner";
|
|
81
|
-
moduleVersion: "0.1.
|
|
82
|
-
ok:
|
|
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;
|
|
7
|
+
moduleVersion: "0.1.4";
|
|
8
|
+
ok: false;
|
|
91
9
|
status: "FAILED";
|
|
92
10
|
error: {
|
|
93
|
-
code: "APPLY_FAILED"
|
|
11
|
+
code: "APPLY_FAILED";
|
|
94
12
|
message: string;
|
|
95
13
|
retryable: boolean;
|
|
96
14
|
};
|
|
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
15
|
};
|
|
116
16
|
observedEffects: never[];
|
|
117
17
|
} | {
|
|
118
18
|
result: {
|
|
119
19
|
contract: "deployment.result.v1";
|
|
120
|
-
|
|
121
|
-
moduleVersion: "0.1.2";
|
|
122
|
-
ok: boolean;
|
|
20
|
+
ok: true;
|
|
123
21
|
status: "SUCCEEDED";
|
|
124
|
-
data?: {} | null;
|
|
125
|
-
checks?: unknown[];
|
|
126
|
-
} | {
|
|
127
|
-
contract: "deployment.result.v1";
|
|
128
22
|
moduleRef: "task-migration-runner";
|
|
129
|
-
moduleVersion: "0.1.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
code: "VERIFY_FAILED";
|
|
134
|
-
message: string;
|
|
135
|
-
retryable: boolean;
|
|
23
|
+
moduleVersion: "0.1.4";
|
|
24
|
+
data: {
|
|
25
|
+
applied: number[];
|
|
26
|
+
pending: number[];
|
|
136
27
|
};
|
|
137
|
-
|
|
28
|
+
};
|
|
29
|
+
observedEffects: string[];
|
|
30
|
+
}>;
|
|
31
|
+
readonly uninstall: (_context: ModuleCommandContext) => Promise<{
|
|
32
|
+
result: {
|
|
33
|
+
readonly contract: "deployment.result.v1";
|
|
34
|
+
readonly ok: true;
|
|
35
|
+
readonly status: "SUCCEEDED";
|
|
36
|
+
readonly moduleRef: "task-migration-runner";
|
|
37
|
+
readonly moduleVersion: "0.1.4";
|
|
138
38
|
};
|
|
139
39
|
observedEffects: never[];
|
|
140
|
-
}
|
|
141
|
-
|
|
40
|
+
}>;
|
|
41
|
+
readonly status: (context: ModuleCommandContext) => Promise<{
|
|
142
42
|
result: {
|
|
143
43
|
contract: "deployment.result.v1";
|
|
44
|
+
ok: true;
|
|
45
|
+
status: "SUCCEEDED";
|
|
144
46
|
moduleRef: "task-migration-runner";
|
|
145
|
-
moduleVersion: "0.1.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
action: string;
|
|
150
|
-
description: string;
|
|
47
|
+
moduleVersion: "0.1.4";
|
|
48
|
+
data: {
|
|
49
|
+
setupStatus: "FAILED" | "READY";
|
|
50
|
+
runtimeStatus: "NOT_APPLICABLE";
|
|
151
51
|
};
|
|
152
|
-
data?: {} | null;
|
|
153
|
-
checks?: unknown[];
|
|
154
52
|
};
|
|
155
53
|
observedEffects: never[];
|
|
156
|
-
}
|
|
54
|
+
}>;
|
|
55
|
+
readonly setup: (context: ModuleCommandContext) => Promise<{
|
|
157
56
|
result: {
|
|
158
|
-
contract: "deployment.result.v1";
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
data?: {} | null;
|
|
164
|
-
checks?: unknown[];
|
|
57
|
+
readonly contract: "deployment.result.v1";
|
|
58
|
+
readonly ok: true;
|
|
59
|
+
readonly status: "SUCCEEDED";
|
|
60
|
+
readonly moduleRef: "task-migration-runner";
|
|
61
|
+
readonly moduleVersion: "0.1.4";
|
|
165
62
|
} | {
|
|
166
63
|
contract: "deployment.result.v1";
|
|
167
64
|
moduleRef: "task-migration-runner";
|
|
168
|
-
moduleVersion: "0.1.
|
|
169
|
-
ok:
|
|
65
|
+
moduleVersion: "0.1.4";
|
|
66
|
+
ok: false;
|
|
170
67
|
status: "FAILED";
|
|
171
68
|
error: {
|
|
172
|
-
code: "
|
|
69
|
+
code: "SETUP_FAILED";
|
|
173
70
|
message: string;
|
|
174
71
|
retryable: boolean;
|
|
175
72
|
};
|
|
176
|
-
data?: {} | null;
|
|
177
|
-
checks?: unknown[];
|
|
178
|
-
};
|
|
179
|
-
observedEffects: string[];
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
export declare const behaviorAdapter: {
|
|
183
|
-
describe: () => {
|
|
184
|
-
result: {
|
|
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[];
|
|
192
73
|
};
|
|
193
74
|
observedEffects: never[];
|
|
194
|
-
}
|
|
195
|
-
|
|
75
|
+
}>;
|
|
76
|
+
readonly docs: (_context: ModuleCommandContext) => Promise<{
|
|
196
77
|
result: {
|
|
197
78
|
contract: "deployment.result.v1";
|
|
198
|
-
|
|
199
|
-
moduleVersion: "0.1.2";
|
|
200
|
-
ok: boolean;
|
|
79
|
+
ok: true;
|
|
201
80
|
status: "SUCCEEDED";
|
|
202
|
-
data?: {} | null;
|
|
203
|
-
checks?: unknown[];
|
|
204
|
-
} | {
|
|
205
|
-
contract: "deployment.result.v1";
|
|
206
81
|
moduleRef: "task-migration-runner";
|
|
207
|
-
moduleVersion: "0.1.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
action: string;
|
|
212
|
-
description: string;
|
|
82
|
+
moduleVersion: "0.1.4";
|
|
83
|
+
data: {
|
|
84
|
+
docs: string;
|
|
85
|
+
setup: string;
|
|
213
86
|
};
|
|
214
|
-
data?: {} | null;
|
|
215
|
-
checks?: unknown[];
|
|
216
87
|
};
|
|
217
88
|
observedEffects: never[];
|
|
218
|
-
}
|
|
219
|
-
|
|
89
|
+
}>;
|
|
90
|
+
readonly start: (_context: ModuleCommandContext) => Promise<{
|
|
220
91
|
result: {
|
|
221
|
-
contract: "deployment.result.v1";
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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[];
|
|
92
|
+
readonly contract: "deployment.result.v1";
|
|
93
|
+
readonly ok: true;
|
|
94
|
+
readonly status: "SUCCEEDED";
|
|
95
|
+
readonly moduleRef: "task-migration-runner";
|
|
96
|
+
readonly moduleVersion: "0.1.4";
|
|
240
97
|
};
|
|
241
98
|
observedEffects: never[];
|
|
242
|
-
}
|
|
243
|
-
|
|
99
|
+
}>;
|
|
100
|
+
readonly stop: (_context: ModuleCommandContext) => Promise<{
|
|
244
101
|
result: {
|
|
245
|
-
contract: "deployment.result.v1";
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
actionRequired: {
|
|
251
|
-
action: string;
|
|
252
|
-
description: string;
|
|
253
|
-
};
|
|
254
|
-
data?: {} | null;
|
|
255
|
-
checks?: unknown[];
|
|
102
|
+
readonly contract: "deployment.result.v1";
|
|
103
|
+
readonly ok: true;
|
|
104
|
+
readonly status: "SUCCEEDED";
|
|
105
|
+
readonly moduleRef: "task-migration-runner";
|
|
106
|
+
readonly moduleVersion: "0.1.4";
|
|
256
107
|
};
|
|
257
108
|
observedEffects: never[];
|
|
258
|
-
}
|
|
109
|
+
}>;
|
|
110
|
+
readonly migrate: (context: ModuleCommandContext) => Promise<{
|
|
259
111
|
result: {
|
|
260
112
|
contract: "deployment.result.v1";
|
|
261
|
-
|
|
262
|
-
moduleVersion: "0.1.2";
|
|
263
|
-
ok: boolean;
|
|
113
|
+
ok: true;
|
|
264
114
|
status: "SUCCEEDED";
|
|
265
|
-
data?: {} | null;
|
|
266
|
-
checks?: unknown[];
|
|
267
|
-
} | {
|
|
268
|
-
contract: "deployment.result.v1";
|
|
269
|
-
moduleRef: "task-migration-runner";
|
|
270
|
-
moduleVersion: "0.1.2";
|
|
271
|
-
ok: boolean;
|
|
272
|
-
status: "FAILED";
|
|
273
|
-
error: {
|
|
274
|
-
code: "APPLY_FAILED" | "VERIFY_FAILED";
|
|
275
|
-
message: string;
|
|
276
|
-
retryable: boolean;
|
|
277
|
-
};
|
|
278
|
-
data?: {} | null;
|
|
279
|
-
checks?: unknown[];
|
|
280
|
-
};
|
|
281
|
-
observedEffects: never[];
|
|
282
|
-
};
|
|
283
|
-
doctor: () => {
|
|
284
|
-
result: {
|
|
285
|
-
contract: "deployment.result.v1";
|
|
286
115
|
moduleRef: "task-migration-runner";
|
|
287
|
-
moduleVersion: "0.1.
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
action: string;
|
|
292
|
-
description: string;
|
|
116
|
+
moduleVersion: "0.1.4";
|
|
117
|
+
data: {
|
|
118
|
+
applied: number[];
|
|
119
|
+
pending: number[];
|
|
293
120
|
};
|
|
294
|
-
data?: {} | null;
|
|
295
|
-
checks?: unknown[];
|
|
296
|
-
};
|
|
297
|
-
observedEffects: never[];
|
|
298
|
-
} | {
|
|
299
|
-
result: {
|
|
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
121
|
} | {
|
|
308
122
|
contract: "deployment.result.v1";
|
|
309
123
|
moduleRef: "task-migration-runner";
|
|
310
|
-
moduleVersion: "0.1.
|
|
311
|
-
ok:
|
|
312
|
-
status: "
|
|
124
|
+
moduleVersion: "0.1.4";
|
|
125
|
+
ok: false;
|
|
126
|
+
status: "FAILED";
|
|
313
127
|
error: {
|
|
314
|
-
code: "
|
|
128
|
+
code: "APPLY_FAILED";
|
|
315
129
|
message: string;
|
|
316
130
|
retryable: boolean;
|
|
317
131
|
};
|
|
318
|
-
data?: {} | null;
|
|
319
|
-
};
|
|
320
|
-
observedEffects: never[];
|
|
321
|
-
};
|
|
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
132
|
};
|
|
336
|
-
observedEffects:
|
|
337
|
-
}
|
|
133
|
+
observedEffects: string[];
|
|
134
|
+
}>;
|
|
135
|
+
readonly migrationStatus: (context: ModuleCommandContext) => Promise<{
|
|
338
136
|
result: {
|
|
339
137
|
contract: "deployment.result.v1";
|
|
340
|
-
|
|
341
|
-
moduleVersion: "0.1.2";
|
|
342
|
-
ok: boolean;
|
|
138
|
+
ok: true;
|
|
343
139
|
status: "SUCCEEDED";
|
|
344
|
-
data?: {} | null;
|
|
345
|
-
checks?: unknown[];
|
|
346
|
-
} | {
|
|
347
|
-
contract: "deployment.result.v1";
|
|
348
140
|
moduleRef: "task-migration-runner";
|
|
349
|
-
moduleVersion: "0.1.
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
141
|
+
moduleVersion: "0.1.4";
|
|
142
|
+
data: {
|
|
143
|
+
migrated: boolean;
|
|
144
|
+
appliedVersions: number[];
|
|
145
|
+
pendingVersions: number[];
|
|
146
|
+
metadataDrift: {
|
|
147
|
+
version: number;
|
|
148
|
+
expectedName: string;
|
|
149
|
+
actualName: string;
|
|
150
|
+
}[];
|
|
151
|
+
checksumDrift: {
|
|
152
|
+
version: number;
|
|
153
|
+
expectedChecksum: string;
|
|
154
|
+
actualChecksum: string;
|
|
155
|
+
}[];
|
|
156
|
+
legacyMetadataVersions: number[];
|
|
157
|
+
missingTables: string[];
|
|
158
|
+
schemaDrift: string[];
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
observedEffects: never[];
|
|
162
|
+
}>;
|
|
367
163
|
};
|
|
@@ -1,53 +1,22 @@
|
|
|
1
|
+
import { join, resolve } from "node:path";
|
|
1
2
|
import { taskMigrations } from "@tomflow/proflow-task-store-sqlite/migrations";
|
|
2
3
|
import { applyMigrations, getMigrationStatus, verifyMigrations, } from "../src/index.js";
|
|
3
4
|
import { descriptor } from "./descriptor.js";
|
|
4
5
|
const base = {
|
|
5
6
|
contract: "deployment.result.v1",
|
|
7
|
+
ok: true,
|
|
8
|
+
status: "SUCCEEDED",
|
|
6
9
|
moduleRef: descriptor.moduleRef,
|
|
7
10
|
moduleVersion: descriptor.moduleVersion,
|
|
8
11
|
};
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
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 }),
|
|
12
|
+
const input = (context) => ({
|
|
13
|
+
databasePath: join(resolve(context.workspaceRoot), ".proflow", "state", "task.sqlite"),
|
|
14
|
+
migrations: taskMigrations,
|
|
31
15
|
});
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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);
|
|
16
|
+
const data = (context) => {
|
|
17
|
+
const i = input(context);
|
|
18
|
+
const status = getMigrationStatus(i);
|
|
19
|
+
const verification = verifyMigrations(i);
|
|
51
20
|
return {
|
|
52
21
|
migrated: verification.ok,
|
|
53
22
|
appliedVersions: status.appliedVersions,
|
|
@@ -58,94 +27,104 @@ function statusData(config) {
|
|
|
58
27
|
missingTables: status.missingTables,
|
|
59
28
|
schemaDrift: status.schemaDrift,
|
|
60
29
|
};
|
|
61
|
-
}
|
|
62
|
-
export
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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 = {
|
|
84
|
-
id: "migration-state-pass",
|
|
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
|
-
};
|
|
109
|
-
},
|
|
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
|
-
}
|
|
30
|
+
};
|
|
31
|
+
export const behaviorAdapter = {
|
|
32
|
+
install: async (context) => {
|
|
33
|
+
const migration = applyMigrations(input(context));
|
|
34
|
+
if (!migration.ok)
|
|
118
35
|
return {
|
|
119
|
-
result:
|
|
120
|
-
|
|
121
|
-
:
|
|
36
|
+
result: {
|
|
37
|
+
...base,
|
|
38
|
+
ok: false,
|
|
39
|
+
status: "FAILED",
|
|
40
|
+
error: {
|
|
41
|
+
code: "APPLY_FAILED",
|
|
42
|
+
message: migration.error?.message ?? "Task migration failed",
|
|
43
|
+
retryable: false,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
122
46
|
observedEffects: [],
|
|
123
47
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
?
|
|
143
|
-
:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
48
|
+
return {
|
|
49
|
+
result: {
|
|
50
|
+
...base,
|
|
51
|
+
data: { applied: migration.applied, pending: migration.pending },
|
|
52
|
+
},
|
|
53
|
+
observedEffects: ["Applies Task Store migration SQL to SQLite"],
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
uninstall: async (_context) => ({
|
|
57
|
+
result: base,
|
|
58
|
+
observedEffects: [],
|
|
59
|
+
}),
|
|
60
|
+
status: async (context) => {
|
|
61
|
+
const v = verifyMigrations(input(context));
|
|
62
|
+
return {
|
|
63
|
+
result: {
|
|
64
|
+
...base,
|
|
65
|
+
data: {
|
|
66
|
+
setupStatus: v.ok ? "READY" : "FAILED",
|
|
67
|
+
runtimeStatus: "NOT_APPLICABLE",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
observedEffects: [],
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
setup: async (context) => {
|
|
74
|
+
const v = verifyMigrations(input(context));
|
|
75
|
+
return {
|
|
76
|
+
result: v.ok
|
|
77
|
+
? base
|
|
78
|
+
: {
|
|
79
|
+
...base,
|
|
80
|
+
ok: false,
|
|
81
|
+
status: "FAILED",
|
|
82
|
+
error: {
|
|
83
|
+
code: "SETUP_FAILED",
|
|
84
|
+
message: v.error?.message ?? "Task migration state is not ready",
|
|
85
|
+
retryable: true,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
observedEffects: [],
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
docs: async (_context) => ({
|
|
92
|
+
result: { ...base, data: { docs: "DOCS.md", setup: "SETUP.md" } },
|
|
93
|
+
observedEffects: [],
|
|
94
|
+
}),
|
|
95
|
+
start: async (_context) => ({
|
|
96
|
+
result: base,
|
|
97
|
+
observedEffects: [],
|
|
98
|
+
}),
|
|
99
|
+
stop: async (_context) => ({
|
|
100
|
+
result: base,
|
|
101
|
+
observedEffects: [],
|
|
102
|
+
}),
|
|
103
|
+
migrate: async (context) => {
|
|
104
|
+
const migration = applyMigrations(input(context));
|
|
105
|
+
return {
|
|
106
|
+
result: migration.ok
|
|
107
|
+
? {
|
|
108
|
+
...base,
|
|
109
|
+
data: { applied: migration.applied, pending: migration.pending },
|
|
110
|
+
}
|
|
111
|
+
: {
|
|
112
|
+
...base,
|
|
113
|
+
ok: false,
|
|
114
|
+
status: "FAILED",
|
|
115
|
+
error: {
|
|
116
|
+
code: "APPLY_FAILED",
|
|
117
|
+
message: migration.error?.message ?? "Task migration failed",
|
|
118
|
+
retryable: false,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
observedEffects: migration.ok
|
|
122
|
+
? ["Applies Task Store migration SQL to SQLite"]
|
|
123
|
+
: [],
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
migrationStatus: async (context) => ({
|
|
127
|
+
result: { ...base, data: data(context) },
|
|
128
|
+
observedEffects: [],
|
|
129
|
+
}),
|
|
130
|
+
};
|
|
@@ -3,11 +3,10 @@ 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.4";
|
|
7
7
|
readonly kind: "cli";
|
|
8
8
|
readonly templateVersion: "1.0.0";
|
|
9
9
|
readonly platformCompatibility: ">=1.0.0 <2.0.0";
|
|
10
|
-
readonly installClass: "core";
|
|
11
10
|
readonly identity: {
|
|
12
11
|
readonly domain: "task-orchestration";
|
|
13
12
|
readonly summary: "Deterministically discovers, applies and verifies Task Store SQLite schema migrations.";
|
|
@@ -19,30 +18,14 @@ export declare const descriptor: {
|
|
|
19
18
|
readonly runtime: "node";
|
|
20
19
|
readonly versionRange: ">=24.19.0";
|
|
21
20
|
}];
|
|
22
|
-
readonly configSlots: readonly [
|
|
23
|
-
readonly key: "databasePath";
|
|
24
|
-
readonly type: "path";
|
|
25
|
-
readonly required: true;
|
|
26
|
-
readonly description: "Task SQLite database path";
|
|
27
|
-
}];
|
|
28
|
-
readonly lifecycle: {
|
|
29
|
-
readonly supported: readonly ["describe", "preflight", "status", "verify", "doctor", "migrate"];
|
|
30
|
-
};
|
|
31
|
-
readonly verification: {
|
|
32
|
-
readonly checks: readonly [{
|
|
33
|
-
readonly id: "migration-state-pass";
|
|
34
|
-
readonly description: "Migration state matches the Task schema";
|
|
35
|
-
readonly lifecycle: "verify";
|
|
36
|
-
}];
|
|
37
|
-
};
|
|
21
|
+
readonly configSlots: readonly [];
|
|
38
22
|
readonly effects: readonly [{
|
|
39
23
|
readonly kind: "filesystem";
|
|
40
24
|
readonly description: "Applies Task Store migration SQL to SQLite";
|
|
41
25
|
readonly retention: "preserve";
|
|
42
26
|
}];
|
|
43
|
-
readonly documentation:
|
|
44
|
-
readonly
|
|
45
|
-
readonly
|
|
46
|
-
|
|
47
|
-
}];
|
|
27
|
+
readonly documentation: {
|
|
28
|
+
readonly docs: "DOCS.md";
|
|
29
|
+
readonly setup: "SETUP.md";
|
|
30
|
+
};
|
|
48
31
|
};
|
|
@@ -3,11 +3,10 @@ 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.4",
|
|
7
7
|
kind: "cli",
|
|
8
8
|
templateVersion: "1.0.0",
|
|
9
9
|
platformCompatibility: ">=1.0.0 <2.0.0",
|
|
10
|
-
installClass: "core",
|
|
11
10
|
identity: {
|
|
12
11
|
domain: "task-orchestration",
|
|
13
12
|
summary: "Deterministically discovers, applies and verifies Task Store SQLite schema migrations.",
|
|
@@ -15,35 +14,13 @@ export const descriptor = {
|
|
|
15
14
|
provides: [],
|
|
16
15
|
requires: [],
|
|
17
16
|
requirements: [
|
|
18
|
-
{ kind: "runtime", runtime: "node", versionRange: ">=24.19.0" },
|
|
19
|
-
],
|
|
20
|
-
configSlots: [
|
|
21
17
|
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
description: "Task SQLite database path",
|
|
18
|
+
kind: "runtime",
|
|
19
|
+
runtime: "node",
|
|
20
|
+
versionRange: ">=24.19.0",
|
|
26
21
|
},
|
|
27
22
|
],
|
|
28
|
-
|
|
29
|
-
supported: [
|
|
30
|
-
"describe",
|
|
31
|
-
"preflight",
|
|
32
|
-
"status",
|
|
33
|
-
"verify",
|
|
34
|
-
"doctor",
|
|
35
|
-
"migrate",
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
verification: {
|
|
39
|
-
checks: [
|
|
40
|
-
{
|
|
41
|
-
id: "migration-state-pass",
|
|
42
|
-
description: "Migration state matches the Task schema",
|
|
43
|
-
lifecycle: "verify",
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
},
|
|
23
|
+
configSlots: [],
|
|
47
24
|
effects: [
|
|
48
25
|
{
|
|
49
26
|
kind: "filesystem",
|
|
@@ -51,11 +28,8 @@ export const descriptor = {
|
|
|
51
28
|
retention: "preserve",
|
|
52
29
|
},
|
|
53
30
|
],
|
|
54
|
-
documentation:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
description: "Package-owned module overview",
|
|
59
|
-
},
|
|
60
|
-
],
|
|
31
|
+
documentation: {
|
|
32
|
+
docs: "DOCS.md",
|
|
33
|
+
setup: "SETUP.md",
|
|
34
|
+
},
|
|
61
35
|
};
|
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.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -12,19 +12,19 @@
|
|
|
12
12
|
"./deployment/descriptor": "./dist/deployment/descriptor.js"
|
|
13
13
|
},
|
|
14
14
|
"bin": {
|
|
15
|
-
"proflow-task-migrate": "./dist/src/cli.js"
|
|
16
|
-
"proflow-task-migration-runner": "./self-install.mjs"
|
|
15
|
+
"proflow-task-migrate": "./dist/src/cli.js"
|
|
17
16
|
},
|
|
18
17
|
"files": [
|
|
19
18
|
"dist",
|
|
20
19
|
"proflow.module.json",
|
|
21
20
|
"conformance.json",
|
|
22
21
|
"README.md",
|
|
23
|
-
"
|
|
22
|
+
"DOCS.md",
|
|
23
|
+
"SETUP.md"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@tomflow/proflow-
|
|
27
|
-
"@tomflow/proflow-
|
|
26
|
+
"@tomflow/proflow-module-contract": "^0.1.4",
|
|
27
|
+
"@tomflow/proflow-task-store-sqlite": "^0.1.4"
|
|
28
28
|
},
|
|
29
29
|
"description": "Deterministically discovers, applies and verifies Task Store SQLite schema migrations.",
|
|
30
30
|
"keywords": [
|
|
@@ -34,11 +34,6 @@
|
|
|
34
34
|
],
|
|
35
35
|
"proflow": {
|
|
36
36
|
"module": true,
|
|
37
|
-
"installClass": "core",
|
|
38
|
-
"installRequires": [
|
|
39
|
-
"@tomflow/proflow-module-contract",
|
|
40
|
-
"@tomflow/proflow-task-store-sqlite"
|
|
41
|
-
],
|
|
42
37
|
"descriptor": "./dist/deployment/descriptor.js",
|
|
43
38
|
"manifest": "./proflow.module.json"
|
|
44
39
|
},
|
package/proflow.module.json
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
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.4",
|
|
7
7
|
"kind": "cli",
|
|
8
8
|
"templateVersion": "1.0.0",
|
|
9
9
|
"platformCompatibility": ">=1.0.0 <2.0.0",
|
|
10
|
-
"installClass": "core",
|
|
11
10
|
"identity": {
|
|
12
11
|
"domain": "task-orchestration",
|
|
13
12
|
"summary": "Deterministically discovers, applies and verifies Task Store SQLite schema migrations."
|
|
@@ -21,33 +20,7 @@
|
|
|
21
20
|
"versionRange": ">=24.19.0"
|
|
22
21
|
}
|
|
23
22
|
],
|
|
24
|
-
"configSlots": [
|
|
25
|
-
{
|
|
26
|
-
"key": "databasePath",
|
|
27
|
-
"type": "path",
|
|
28
|
-
"required": true,
|
|
29
|
-
"description": "Task SQLite database path"
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
"lifecycle": {
|
|
33
|
-
"supported": [
|
|
34
|
-
"describe",
|
|
35
|
-
"preflight",
|
|
36
|
-
"status",
|
|
37
|
-
"verify",
|
|
38
|
-
"doctor",
|
|
39
|
-
"migrate"
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
"verification": {
|
|
43
|
-
"checks": [
|
|
44
|
-
{
|
|
45
|
-
"id": "migration-state-pass",
|
|
46
|
-
"description": "Migration state matches the Task schema",
|
|
47
|
-
"lifecycle": "verify"
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
},
|
|
23
|
+
"configSlots": [],
|
|
51
24
|
"effects": [
|
|
52
25
|
{
|
|
53
26
|
"kind": "filesystem",
|
|
@@ -55,11 +28,8 @@
|
|
|
55
28
|
"retention": "preserve"
|
|
56
29
|
}
|
|
57
30
|
],
|
|
58
|
-
"documentation":
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"description": "Package-owned module overview"
|
|
63
|
-
}
|
|
64
|
-
]
|
|
31
|
+
"documentation": {
|
|
32
|
+
"docs": "DOCS.md",
|
|
33
|
+
"setup": "SETUP.md"
|
|
34
|
+
}
|
|
65
35
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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.
|
package/self-install.mjs
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { spawnSync } from "node:child_process";
|
|
3
|
-
|
|
4
|
-
const [command, ...rest] = process.argv.slice(2);
|
|
5
|
-
const usage = "Usage: npx @tomflow/proflow-task-migration-runner install\n";
|
|
6
|
-
if (command === "--help" || command === "-h") {
|
|
7
|
-
process.stdout.write(usage);
|
|
8
|
-
process.exit(0);
|
|
9
|
-
}
|
|
10
|
-
if (command !== "install" || rest.length > 0) {
|
|
11
|
-
process.stderr.write(usage);
|
|
12
|
-
process.exit(2);
|
|
13
|
-
}
|
|
14
|
-
const executable = process.platform === "win32" ? "platform.cmd" : "platform";
|
|
15
|
-
const result = spawnSync(
|
|
16
|
-
executable,
|
|
17
|
-
[
|
|
18
|
-
"install",
|
|
19
|
-
"@tomflow/proflow-task-migration-runner",
|
|
20
|
-
"--workspace",
|
|
21
|
-
process.cwd(),
|
|
22
|
-
],
|
|
23
|
-
{ cwd: process.cwd(), env: process.env, stdio: "inherit" },
|
|
24
|
-
);
|
|
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
|
-
}
|
|
34
|
-
process.exit(result.status ?? 1);
|