@iwonz/ywtc 4.0.1 → 4.1.1
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 +26 -0
- package/README.md +45 -57
- package/dist/cli-arguments.d.ts +3 -2
- package/dist/cli-arguments.js +42 -37
- package/dist/cli-arguments.js.map +1 -1
- package/dist/cli.js +18 -141
- package/dist/cli.js.map +1 -1
- package/dist/interactive-init.d.ts +3 -3
- package/dist/interactive-init.js +7 -5
- package/dist/interactive-init.js.map +1 -1
- package/dist/interactive-migrate.d.ts +23 -0
- package/dist/interactive-migrate.js +578 -0
- package/dist/interactive-migrate.js.map +1 -0
- package/dist/migration-command.d.ts +19 -0
- package/dist/migration-command.js +160 -0
- package/dist/migration-command.js.map +1 -0
- package/dist/report-ui/index.html +19 -25
- package/dist/{init-prompts.d.ts → wizard-prompts.d.ts} +2 -2
- package/dist/{init-prompts.js → wizard-prompts.js} +3 -3
- package/dist/wizard-prompts.js.map +1 -0
- package/docs/assets/readme-header.png +0 -0
- package/docs/assets/report-header-transparent.png +0 -0
- package/package.json +3 -7
- package/dist/init-prompts.js.map +0 -1
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { readWorkspaceConfig } from './config.js';
|
|
3
|
+
import { safeFilename } from './input.js';
|
|
4
|
+
import { runInteractiveInit } from './interactive-init.js';
|
|
5
|
+
import { runMigrationCommand } from './migration-command.js';
|
|
6
|
+
import { openReportFile } from './report-catalog.js';
|
|
7
|
+
import { WizardCancelledError } from './wizard-prompts.js';
|
|
8
|
+
import { resolveWorkspace, workspaceIsInitialized } from './workspace.js';
|
|
9
|
+
function required(value) {
|
|
10
|
+
return value.trim() ? undefined : 'Value is required.';
|
|
11
|
+
}
|
|
12
|
+
function exportDirectory(value) {
|
|
13
|
+
return required(value) ?? (/^https?:\/\//i.test(value.trim()) ? 'Use a filesystem directory, not an HTTP(S) URL.' : undefined);
|
|
14
|
+
}
|
|
15
|
+
function navigation(prompter, id) {
|
|
16
|
+
return prompter.select({
|
|
17
|
+
id,
|
|
18
|
+
message: 'Next step',
|
|
19
|
+
options: [
|
|
20
|
+
{ value: 'continue', label: 'Continue' },
|
|
21
|
+
{ value: 'back', label: 'Back' },
|
|
22
|
+
{ value: 'cancel', label: 'Cancel' },
|
|
23
|
+
],
|
|
24
|
+
initialValue: 'continue',
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function profileBase(profile) {
|
|
28
|
+
return profile.type === 'yandex-wiki' ? profile.webUrl : profile.baseUrl;
|
|
29
|
+
}
|
|
30
|
+
function matchesUrl(locator, profile) {
|
|
31
|
+
try {
|
|
32
|
+
const candidate = new URL(locator);
|
|
33
|
+
const base = new URL(profileBase(profile));
|
|
34
|
+
const basePath = base.pathname.replace(/\/+$/, '');
|
|
35
|
+
return candidate.origin === base.origin
|
|
36
|
+
&& (!basePath || candidate.pathname === basePath || candidate.pathname.startsWith(`${basePath}/`));
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function profilesFor(config, provider) {
|
|
43
|
+
return Object.values(config.profiles)
|
|
44
|
+
.filter((profile) => profile.type === provider)
|
|
45
|
+
.sort((left, right) => left.name.localeCompare(right.name));
|
|
46
|
+
}
|
|
47
|
+
function suggestedProfile(config, provider, locator, requested) {
|
|
48
|
+
const profiles = profilesFor(config, provider);
|
|
49
|
+
if (requested && profiles.some((profile) => profile.name === requested))
|
|
50
|
+
return requested;
|
|
51
|
+
const matches = profiles
|
|
52
|
+
.filter((profile) => matchesUrl(locator, profile))
|
|
53
|
+
.sort((left, right) => profileBase(right).length - profileBase(left).length);
|
|
54
|
+
if (matches.length > 0)
|
|
55
|
+
return matches[0].name;
|
|
56
|
+
return profiles[0]?.name;
|
|
57
|
+
}
|
|
58
|
+
function inferredProvider(config, locator, requestedProfile, fallback) {
|
|
59
|
+
const requested = requestedProfile ? config.profiles[requestedProfile] : undefined;
|
|
60
|
+
if (requested)
|
|
61
|
+
return requested.type;
|
|
62
|
+
const matches = Object.values(config.profiles)
|
|
63
|
+
.filter((profile) => matchesUrl(locator, profile))
|
|
64
|
+
.sort((left, right) => profileBase(right).length - profileBase(left).length);
|
|
65
|
+
return matches[0]?.type ?? fallback;
|
|
66
|
+
}
|
|
67
|
+
function safeSourceName(locator) {
|
|
68
|
+
let value = locator.trim();
|
|
69
|
+
try {
|
|
70
|
+
const url = new URL(value);
|
|
71
|
+
value = decodeURIComponent(url.pathname).replace(/\/+$/, '').split('/').pop() ?? '';
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
value = value.replace(/\/+$/, '').split('/').pop() ?? value;
|
|
75
|
+
}
|
|
76
|
+
return safeFilename(value || 'export').replace(/\.[^.]+$/, '').slice(0, 80) || 'export';
|
|
77
|
+
}
|
|
78
|
+
function defaultExportPath(source) {
|
|
79
|
+
return path.join('.', 'exports', safeSourceName(source));
|
|
80
|
+
}
|
|
81
|
+
async function defaultInitialize(workdir, prompter) {
|
|
82
|
+
return runInteractiveInit({ workdir, prompter });
|
|
83
|
+
}
|
|
84
|
+
async function loadWorkspace(options, explicit) {
|
|
85
|
+
const workspace = await resolveWorkspace({
|
|
86
|
+
explicit,
|
|
87
|
+
...(options.cwd ? { cwd: options.cwd } : {}),
|
|
88
|
+
...(options.homeDirectory ? { homeDirectory: options.homeDirectory } : {}),
|
|
89
|
+
});
|
|
90
|
+
if (!await workspaceIsInitialized(workspace))
|
|
91
|
+
return { workspace, error: `Missing ${workspace.configFile}` };
|
|
92
|
+
try {
|
|
93
|
+
return { workspace, config: readWorkspaceConfig(workspace.configFile) };
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
return { workspace, error: error instanceof Error ? error.message : String(error) };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async function workspaceStep(options, draft) {
|
|
100
|
+
const { prompter } = options;
|
|
101
|
+
prompter.info('Step 1 of 6 · Workspace');
|
|
102
|
+
const initialWorkspace = draft.workspace ?? await resolveWorkspace({
|
|
103
|
+
...(options.command.workdir ? { explicit: options.command.workdir } : {}),
|
|
104
|
+
...(options.cwd ? { cwd: options.cwd } : {}),
|
|
105
|
+
...(options.homeDirectory ? { homeDirectory: options.homeDirectory } : {}),
|
|
106
|
+
});
|
|
107
|
+
let initialPath = initialWorkspace.root;
|
|
108
|
+
while (true) {
|
|
109
|
+
const selected = (await prompter.text({
|
|
110
|
+
id: 'migration.workspace.path',
|
|
111
|
+
message: 'Working directory',
|
|
112
|
+
initialValue: initialPath,
|
|
113
|
+
validate: required,
|
|
114
|
+
})).trim();
|
|
115
|
+
const loaded = await loadWorkspace(options, selected);
|
|
116
|
+
if (loaded.config) {
|
|
117
|
+
draft.workspace = loaded.workspace;
|
|
118
|
+
draft.config = loaded.config;
|
|
119
|
+
draft.sourceProvider = inferredProvider(loaded.config, draft.source, draft.sourceProfile ?? options.command.sourceProfile, draft.sourceProvider);
|
|
120
|
+
if (!draft.destinationKind || ['yandex-wiki', 'confluence'].includes(draft.destinationKind)) {
|
|
121
|
+
draft.destinationKind = inferredProvider(loaded.config, draft.destination, draft.destinationProfile ?? options.command.destinationProfile, draft.destinationKind === 'yandex-wiki' ? 'yandex-wiki' : 'confluence');
|
|
122
|
+
}
|
|
123
|
+
return 'continue';
|
|
124
|
+
}
|
|
125
|
+
prompter.error(loaded.error ?? 'Workspace configuration is unavailable.');
|
|
126
|
+
const action = await prompter.select({
|
|
127
|
+
id: 'migration.workspace.unavailable',
|
|
128
|
+
message: 'Workspace is not ready',
|
|
129
|
+
options: [
|
|
130
|
+
{ value: 'configure', label: 'Configure this workspace', hint: 'open the initialization wizard' },
|
|
131
|
+
{ value: 'change', label: 'Choose another directory' },
|
|
132
|
+
{ value: 'exit', label: 'Exit without changes' },
|
|
133
|
+
],
|
|
134
|
+
initialValue: 'configure',
|
|
135
|
+
});
|
|
136
|
+
if (action === 'exit')
|
|
137
|
+
return 'exit';
|
|
138
|
+
if (action === 'change') {
|
|
139
|
+
initialPath = loaded.workspace.root;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const initialized = await (options.initialize ?? defaultInitialize)(loaded.workspace.root, prompter);
|
|
143
|
+
if (initialized.code === 130 || initialized.status === 'cancelled')
|
|
144
|
+
throw new WizardCancelledError();
|
|
145
|
+
const reloaded = await loadWorkspace(options, loaded.workspace.root);
|
|
146
|
+
if (reloaded.config) {
|
|
147
|
+
draft.workspace = reloaded.workspace;
|
|
148
|
+
draft.config = reloaded.config;
|
|
149
|
+
draft.sourceProvider = inferredProvider(reloaded.config, draft.source, draft.sourceProfile ?? options.command.sourceProfile, draft.sourceProvider);
|
|
150
|
+
if (draft.destinationKind === 'yandex-wiki' || draft.destinationKind === 'confluence') {
|
|
151
|
+
draft.destinationKind = inferredProvider(reloaded.config, draft.destination, draft.destinationProfile ?? options.command.destinationProfile, draft.destinationKind);
|
|
152
|
+
}
|
|
153
|
+
return 'continue';
|
|
154
|
+
}
|
|
155
|
+
prompter.error(reloaded.error ?? 'Workspace is still not ready.');
|
|
156
|
+
initialPath = loaded.workspace.root;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
async function sourceStep(draft, prompter) {
|
|
160
|
+
if (!draft.config)
|
|
161
|
+
throw new Error('Workspace configuration must be loaded before source selection.');
|
|
162
|
+
prompter.info('Step 2 of 6 · Source');
|
|
163
|
+
while (true) {
|
|
164
|
+
const provider = await prompter.select({
|
|
165
|
+
id: 'migration.source.provider',
|
|
166
|
+
message: 'Source provider',
|
|
167
|
+
options: [
|
|
168
|
+
{ value: 'yandex-wiki', label: 'Yandex Wiki' },
|
|
169
|
+
{ value: 'confluence', label: 'Confluence' },
|
|
170
|
+
],
|
|
171
|
+
initialValue: draft.sourceProvider,
|
|
172
|
+
});
|
|
173
|
+
const available = profilesFor(draft.config, provider);
|
|
174
|
+
if (available.length === 0) {
|
|
175
|
+
prompter.error(`No ${provider} connection exists in ${draft.config.configFile}.`);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
const locator = (await prompter.text({
|
|
179
|
+
id: 'migration.source.locator',
|
|
180
|
+
message: 'Source page URL, ID, or slug',
|
|
181
|
+
initialValue: draft.source,
|
|
182
|
+
validate: required,
|
|
183
|
+
})).trim();
|
|
184
|
+
const initialProfile = suggestedProfile(draft.config, provider, locator, draft.sourceProfile);
|
|
185
|
+
const profile = await prompter.select({
|
|
186
|
+
id: 'migration.source.profile',
|
|
187
|
+
message: 'Source connection',
|
|
188
|
+
options: available.map((item) => ({ value: item.name, label: item.name, hint: profileBase(item) })),
|
|
189
|
+
...(initialProfile ? { initialValue: initialProfile } : {}),
|
|
190
|
+
});
|
|
191
|
+
const selected = draft.config.profiles[profile];
|
|
192
|
+
if (!selected || selected.type !== provider) {
|
|
193
|
+
prompter.error('Selected source connection is not compatible with the provider.');
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (/^https?:\/\//i.test(locator) && !matchesUrl(locator, selected)) {
|
|
197
|
+
prompter.error(`Source URL does not belong to ${profileBase(selected)}.`);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
draft.sourceProvider = provider;
|
|
201
|
+
draft.source = locator;
|
|
202
|
+
draft.sourceProfile = profile;
|
|
203
|
+
return navigation(prompter, 'migration.source.navigation');
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
async function destinationStep(draft, prompter) {
|
|
207
|
+
if (!draft.config)
|
|
208
|
+
throw new Error('Workspace configuration must be loaded before destination selection.');
|
|
209
|
+
prompter.info('Step 3 of 6 · Destination');
|
|
210
|
+
while (true) {
|
|
211
|
+
const kind = await prompter.select({
|
|
212
|
+
id: 'migration.destination.kind',
|
|
213
|
+
message: 'Destination',
|
|
214
|
+
options: [
|
|
215
|
+
{ value: 'yandex-wiki', label: 'Yandex Wiki' },
|
|
216
|
+
{ value: 'confluence', label: 'Confluence' },
|
|
217
|
+
{ value: 'markdown', label: 'Markdown directory' },
|
|
218
|
+
{ value: 'html', label: 'Static HTML directory' },
|
|
219
|
+
],
|
|
220
|
+
initialValue: draft.destinationKind,
|
|
221
|
+
});
|
|
222
|
+
if (kind === 'markdown' || kind === 'html') {
|
|
223
|
+
const initialDirectory = !draft.destination || /^https?:\/\//i.test(draft.destination)
|
|
224
|
+
? defaultExportPath(draft.source)
|
|
225
|
+
: draft.destination;
|
|
226
|
+
const directory = (await prompter.text({
|
|
227
|
+
id: 'migration.destination.directory',
|
|
228
|
+
message: `${kind === 'html' ? 'HTML' : 'Markdown'} output directory`,
|
|
229
|
+
initialValue: initialDirectory,
|
|
230
|
+
validate: exportDirectory,
|
|
231
|
+
})).trim();
|
|
232
|
+
draft.destinationKind = kind;
|
|
233
|
+
draft.destination = directory;
|
|
234
|
+
delete draft.destinationProfile;
|
|
235
|
+
return navigation(prompter, 'migration.destination.navigation');
|
|
236
|
+
}
|
|
237
|
+
const available = profilesFor(draft.config, kind);
|
|
238
|
+
if (available.length === 0) {
|
|
239
|
+
prompter.error(`No ${kind} connection exists in ${draft.config.configFile}.`);
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
const locator = (await prompter.text({
|
|
243
|
+
id: 'migration.destination.locator',
|
|
244
|
+
message: 'Destination parent page URL, ID, or slug',
|
|
245
|
+
initialValue: draft.destination,
|
|
246
|
+
validate: required,
|
|
247
|
+
})).trim();
|
|
248
|
+
const initialProfile = suggestedProfile(draft.config, kind, locator, draft.destinationProfile);
|
|
249
|
+
const profile = await prompter.select({
|
|
250
|
+
id: 'migration.destination.profile',
|
|
251
|
+
message: 'Destination connection',
|
|
252
|
+
options: available.map((item) => ({ value: item.name, label: item.name, hint: profileBase(item) })),
|
|
253
|
+
...(initialProfile ? { initialValue: initialProfile } : {}),
|
|
254
|
+
});
|
|
255
|
+
const selected = draft.config.profiles[profile];
|
|
256
|
+
if (!selected || selected.type !== kind) {
|
|
257
|
+
prompter.error('Selected destination connection is not compatible with the provider.');
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
if (/^https?:\/\//i.test(locator) && !matchesUrl(locator, selected)) {
|
|
261
|
+
prompter.error(`Destination URL does not belong to ${profileBase(selected)}.`);
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
draft.destinationKind = kind;
|
|
265
|
+
draft.destination = locator;
|
|
266
|
+
draft.destinationProfile = profile;
|
|
267
|
+
draft.archive = false;
|
|
268
|
+
return navigation(prompter, 'migration.destination.navigation');
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
async function scopeStep(draft, prompter) {
|
|
272
|
+
prompter.info('Step 4 of 6 · Scope');
|
|
273
|
+
draft.scope = await prompter.select({
|
|
274
|
+
id: 'migration.scope',
|
|
275
|
+
message: 'Pages to transfer',
|
|
276
|
+
options: [
|
|
277
|
+
{ value: 'page', label: 'Current page only' },
|
|
278
|
+
{ value: 'subtree', label: 'Page and all descendants' },
|
|
279
|
+
{ value: 'linked', label: 'Page and all reachable internal links' },
|
|
280
|
+
],
|
|
281
|
+
initialValue: draft.scope,
|
|
282
|
+
});
|
|
283
|
+
return navigation(prompter, 'migration.scope.navigation');
|
|
284
|
+
}
|
|
285
|
+
async function commentsStep(draft, prompter) {
|
|
286
|
+
prompter.info('Step 5 of 6 · Comments');
|
|
287
|
+
const comments = await prompter.select({
|
|
288
|
+
id: 'migration.comments',
|
|
289
|
+
message: 'Archive page comments',
|
|
290
|
+
options: [
|
|
291
|
+
{ value: 'yes', label: 'Transfer comments' },
|
|
292
|
+
{ value: 'no', label: 'Skip comments' },
|
|
293
|
+
],
|
|
294
|
+
initialValue: draft.comments ? 'yes' : 'no',
|
|
295
|
+
});
|
|
296
|
+
draft.comments = comments === 'yes';
|
|
297
|
+
return navigation(prompter, 'migration.comments.navigation');
|
|
298
|
+
}
|
|
299
|
+
async function archiveStep(draft, prompter) {
|
|
300
|
+
prompter.info('Step 6 of 6 · Archive');
|
|
301
|
+
const archive = await prompter.select({
|
|
302
|
+
id: 'migration.archive',
|
|
303
|
+
message: 'Also create a ZIP archive',
|
|
304
|
+
options: [
|
|
305
|
+
{ value: 'no', label: 'Do not create ZIP' },
|
|
306
|
+
{ value: 'yes', label: 'Create ZIP next to the export directory' },
|
|
307
|
+
],
|
|
308
|
+
initialValue: draft.archive ? 'yes' : 'no',
|
|
309
|
+
});
|
|
310
|
+
draft.archive = archive === 'yes';
|
|
311
|
+
return navigation(prompter, 'migration.archive.navigation');
|
|
312
|
+
}
|
|
313
|
+
function draftSummary(draft) {
|
|
314
|
+
const destination = draft.destinationKind === 'markdown' || draft.destinationKind === 'html'
|
|
315
|
+
? `${draft.destinationKind.toUpperCase()} · ${draft.destination}`
|
|
316
|
+
: `${draft.destinationKind} · ${draft.destinationProfile} · ${draft.destination}`;
|
|
317
|
+
return [
|
|
318
|
+
`Workspace: ${draft.workspace?.root ?? 'not selected'}`,
|
|
319
|
+
`Source: ${draft.sourceProvider} · ${draft.sourceProfile} · ${draft.source}`,
|
|
320
|
+
`Destination: ${destination}`,
|
|
321
|
+
`Scope: ${draft.scope} · source status ${draft.sourceStatus}`,
|
|
322
|
+
`Comments: ${draft.comments ? 'enabled' : 'disabled'}`,
|
|
323
|
+
...(draft.destinationKind === 'markdown' || draft.destinationKind === 'html'
|
|
324
|
+
? [`ZIP archive: ${draft.archive ? 'enabled' : 'disabled'}`]
|
|
325
|
+
: []),
|
|
326
|
+
].join('\n');
|
|
327
|
+
}
|
|
328
|
+
function readyCommand(draft, input, dryRun) {
|
|
329
|
+
if (!draft.workspace || !draft.config)
|
|
330
|
+
throw new Error('Workspace is not ready.');
|
|
331
|
+
if (!draft.source || !draft.destination || !draft.sourceProfile)
|
|
332
|
+
throw new Error('Source and destination are required.');
|
|
333
|
+
const fileDestination = draft.destinationKind === 'markdown' || draft.destinationKind === 'html';
|
|
334
|
+
if (!fileDestination && !draft.destinationProfile)
|
|
335
|
+
throw new Error('Remote destination profile is required.');
|
|
336
|
+
const common = {
|
|
337
|
+
command: 'migrate',
|
|
338
|
+
source: draft.source,
|
|
339
|
+
destination: draft.destination,
|
|
340
|
+
sourceProfile: draft.sourceProfile,
|
|
341
|
+
scope: draft.scope,
|
|
342
|
+
sourceStatus: draft.sourceStatus,
|
|
343
|
+
comments: draft.comments,
|
|
344
|
+
archive: fileDestination && draft.archive,
|
|
345
|
+
workdir: draft.workspace.root,
|
|
346
|
+
dryRun,
|
|
347
|
+
fresh: input.fresh,
|
|
348
|
+
openReport: input.openReport,
|
|
349
|
+
...(input.concurrency !== undefined ? { concurrency: input.concurrency } : {}),
|
|
350
|
+
...(input.stateFilename ? { stateFilename: input.stateFilename } : {}),
|
|
351
|
+
};
|
|
352
|
+
if (fileDestination)
|
|
353
|
+
return { ...common, format: draft.destinationKind };
|
|
354
|
+
return { ...common, destinationProfile: draft.destinationProfile };
|
|
355
|
+
}
|
|
356
|
+
export function liveAllowedAfterDryRun(summary) {
|
|
357
|
+
return summary.inventoryComplete
|
|
358
|
+
&& summary.rootErrors === 0
|
|
359
|
+
&& summary.failed === 0
|
|
360
|
+
&& summary.blocked === 0
|
|
361
|
+
&& summary.conflicts === 0;
|
|
362
|
+
}
|
|
363
|
+
async function reviewAction(draft, prompter) {
|
|
364
|
+
prompter.note(draftSummary(draft), 'Migration summary');
|
|
365
|
+
return prompter.select({
|
|
366
|
+
id: 'migration.review.action',
|
|
367
|
+
message: 'What should ywtc do?',
|
|
368
|
+
options: [
|
|
369
|
+
{ value: 'dry-run', label: 'Run dry-run first', hint: 'read-only discovery and report' },
|
|
370
|
+
{ value: 'live', label: 'Run transfer now' },
|
|
371
|
+
{ value: 'edit', label: 'Edit parameters' },
|
|
372
|
+
{ value: 'exit', label: 'Exit without running' },
|
|
373
|
+
],
|
|
374
|
+
initialValue: 'dry-run',
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
async function editStep(prompter, draft) {
|
|
378
|
+
const section = await prompter.select({
|
|
379
|
+
id: 'migration.edit.section',
|
|
380
|
+
message: 'Parameter group to edit',
|
|
381
|
+
options: [
|
|
382
|
+
{ value: 'workspace', label: 'Workspace' },
|
|
383
|
+
{ value: 'source', label: 'Source' },
|
|
384
|
+
{ value: 'destination', label: 'Destination' },
|
|
385
|
+
{ value: 'scope', label: 'Scope' },
|
|
386
|
+
{ value: 'comments', label: 'Comments' },
|
|
387
|
+
...((draft.destinationKind === 'markdown' || draft.destinationKind === 'html')
|
|
388
|
+
? [{ value: 'archive', label: 'Archive' }]
|
|
389
|
+
: []),
|
|
390
|
+
{ value: 'review', label: 'Back to summary' },
|
|
391
|
+
{ value: 'cancel', label: 'Cancel' },
|
|
392
|
+
],
|
|
393
|
+
initialValue: 'source',
|
|
394
|
+
});
|
|
395
|
+
if (section === 'cancel')
|
|
396
|
+
throw new WizardCancelledError();
|
|
397
|
+
return { workspace: 0, source: 1, destination: 2, scope: 3, comments: 4, archive: 5, review: 6 }[section];
|
|
398
|
+
}
|
|
399
|
+
function initialDraft(command) {
|
|
400
|
+
const format = command.format;
|
|
401
|
+
return {
|
|
402
|
+
sourceProvider: 'yandex-wiki',
|
|
403
|
+
...(command.sourceProfile ? { sourceProfile: command.sourceProfile } : {}),
|
|
404
|
+
source: command.source ?? '',
|
|
405
|
+
destinationKind: format ?? 'confluence',
|
|
406
|
+
...(command.destinationProfile ? { destinationProfile: command.destinationProfile } : {}),
|
|
407
|
+
destination: command.destination ?? '',
|
|
408
|
+
scope: command.scope,
|
|
409
|
+
sourceStatus: command.sourceStatus,
|
|
410
|
+
comments: command.comments,
|
|
411
|
+
archive: command.archive,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
export async function runInteractiveMigration(options) {
|
|
415
|
+
const { prompter } = options;
|
|
416
|
+
const execute = options.execute ?? runMigrationCommand;
|
|
417
|
+
const openReport = options.openReport ?? openReportFile;
|
|
418
|
+
const draft = initialDraft(options.command);
|
|
419
|
+
let step = 0;
|
|
420
|
+
let lastCode = 0;
|
|
421
|
+
let lastOutcome;
|
|
422
|
+
let lastCommand;
|
|
423
|
+
prompter.intro('ywtc interactive migration');
|
|
424
|
+
try {
|
|
425
|
+
while (true) {
|
|
426
|
+
if (step === 0) {
|
|
427
|
+
if (await workspaceStep(options, draft) === 'exit') {
|
|
428
|
+
prompter.outro('Migration was not started.');
|
|
429
|
+
return { status: 'exited', code: lastCode, ...(lastCommand ? { command: lastCommand } : {}), ...(lastOutcome ? { outcome: lastOutcome } : {}) };
|
|
430
|
+
}
|
|
431
|
+
step = 1;
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
if (step === 1) {
|
|
435
|
+
const next = await sourceStep(draft, prompter);
|
|
436
|
+
if (next === 'cancel')
|
|
437
|
+
throw new WizardCancelledError();
|
|
438
|
+
step = next === 'back' ? 0 : 2;
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
if (step === 2) {
|
|
442
|
+
const next = await destinationStep(draft, prompter);
|
|
443
|
+
if (next === 'cancel')
|
|
444
|
+
throw new WizardCancelledError();
|
|
445
|
+
step = next === 'back' ? 1 : 3;
|
|
446
|
+
continue;
|
|
447
|
+
}
|
|
448
|
+
if (step === 3) {
|
|
449
|
+
const next = await scopeStep(draft, prompter);
|
|
450
|
+
if (next === 'cancel')
|
|
451
|
+
throw new WizardCancelledError();
|
|
452
|
+
step = next === 'back' ? 2 : 4;
|
|
453
|
+
continue;
|
|
454
|
+
}
|
|
455
|
+
if (step === 4) {
|
|
456
|
+
const next = await commentsStep(draft, prompter);
|
|
457
|
+
if (next === 'cancel')
|
|
458
|
+
throw new WizardCancelledError();
|
|
459
|
+
step = next === 'back' ? 3 : (draft.destinationKind === 'markdown' || draft.destinationKind === 'html' ? 5 : 6);
|
|
460
|
+
continue;
|
|
461
|
+
}
|
|
462
|
+
if (step === 5) {
|
|
463
|
+
const next = await archiveStep(draft, prompter);
|
|
464
|
+
if (next === 'cancel')
|
|
465
|
+
throw new WizardCancelledError();
|
|
466
|
+
step = next === 'back' ? 4 : 6;
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
const action = await reviewAction(draft, prompter);
|
|
470
|
+
if (action === 'exit') {
|
|
471
|
+
prompter.outro(lastOutcome ? 'Migration wizard finished.' : 'Migration was not started.');
|
|
472
|
+
return { status: 'exited', code: lastCode, ...(lastCommand ? { command: lastCommand } : {}), ...(lastOutcome ? { outcome: lastOutcome } : {}) };
|
|
473
|
+
}
|
|
474
|
+
if (action === 'edit') {
|
|
475
|
+
step = await editStep(prompter, draft);
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
if (action === 'live') {
|
|
479
|
+
lastCommand = readyCommand(draft, options.command, false);
|
|
480
|
+
try {
|
|
481
|
+
lastOutcome = await execute(lastCommand);
|
|
482
|
+
lastCode = lastOutcome.code;
|
|
483
|
+
prompter.outro(lastCode === 0 ? 'Migration completed.' : 'Migration finished with issues.');
|
|
484
|
+
return { status: 'completed', code: lastCode, command: lastCommand, outcome: lastOutcome };
|
|
485
|
+
}
|
|
486
|
+
catch (error) {
|
|
487
|
+
prompter.error(error instanceof Error ? error.message : String(error));
|
|
488
|
+
prompter.outro('Migration failed. Review the printed report or diagnostic, then rerun the wizard.');
|
|
489
|
+
return { status: 'completed', code: 2, command: lastCommand };
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
while (true) {
|
|
493
|
+
lastCommand = readyCommand(draft, options.command, true);
|
|
494
|
+
try {
|
|
495
|
+
lastOutcome = await execute(lastCommand);
|
|
496
|
+
lastCode = lastOutcome.code;
|
|
497
|
+
}
|
|
498
|
+
catch (error) {
|
|
499
|
+
lastCode = 2;
|
|
500
|
+
prompter.error(error instanceof Error ? error.message : String(error));
|
|
501
|
+
const failureAction = await prompter.select({
|
|
502
|
+
id: 'migration.dry-run.failure',
|
|
503
|
+
message: 'Dry-run could not complete',
|
|
504
|
+
options: [
|
|
505
|
+
{ value: 'edit', label: 'Edit parameters' },
|
|
506
|
+
{ value: 'repeat', label: 'Repeat dry-run' },
|
|
507
|
+
{ value: 'exit', label: 'Exit' },
|
|
508
|
+
],
|
|
509
|
+
initialValue: 'edit',
|
|
510
|
+
});
|
|
511
|
+
if (failureAction === 'repeat')
|
|
512
|
+
continue;
|
|
513
|
+
if (failureAction === 'edit') {
|
|
514
|
+
step = await editStep(prompter, draft);
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
prompter.outro('Dry-run failed; migration was not started.');
|
|
518
|
+
return { status: 'exited', code: lastCode, command: lastCommand };
|
|
519
|
+
}
|
|
520
|
+
if (lastOutcome.code === 130 || lastOutcome.code === 143) {
|
|
521
|
+
return { status: 'completed', code: lastOutcome.code, command: lastCommand, outcome: lastOutcome };
|
|
522
|
+
}
|
|
523
|
+
const allowLive = Boolean(lastOutcome.result && liveAllowedAfterDryRun(lastOutcome.result.summary));
|
|
524
|
+
const next = await prompter.select({
|
|
525
|
+
id: 'migration.after-dry-run',
|
|
526
|
+
message: allowLive ? 'Dry-run finished. What next?' : 'Dry-run found blocking issues. What next?',
|
|
527
|
+
options: [
|
|
528
|
+
...(lastOutcome.reportPaths ? [{ value: 'report', label: 'Open HTML report' }] : []),
|
|
529
|
+
...(allowLive ? [{ value: 'live', label: 'Run live transfer' }] : []),
|
|
530
|
+
{ value: 'edit', label: 'Edit parameters' },
|
|
531
|
+
{ value: 'repeat', label: 'Repeat dry-run' },
|
|
532
|
+
{ value: 'exit', label: 'Finish' },
|
|
533
|
+
],
|
|
534
|
+
initialValue: allowLive ? 'live' : (lastOutcome.reportPaths ? 'report' : 'edit'),
|
|
535
|
+
});
|
|
536
|
+
if (next === 'report' && lastOutcome.reportPaths) {
|
|
537
|
+
try {
|
|
538
|
+
await openReport(lastOutcome.reportPaths.html);
|
|
539
|
+
prompter.success(`Opened ${lastOutcome.reportPaths.html}`);
|
|
540
|
+
}
|
|
541
|
+
catch (error) {
|
|
542
|
+
prompter.error(error instanceof Error ? error.message : String(error));
|
|
543
|
+
}
|
|
544
|
+
continue;
|
|
545
|
+
}
|
|
546
|
+
if (next === 'repeat')
|
|
547
|
+
continue;
|
|
548
|
+
if (next === 'edit') {
|
|
549
|
+
step = await editStep(prompter, draft);
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
552
|
+
if (next === 'live') {
|
|
553
|
+
lastCommand = readyCommand(draft, options.command, false);
|
|
554
|
+
try {
|
|
555
|
+
lastOutcome = await execute(lastCommand);
|
|
556
|
+
lastCode = lastOutcome.code;
|
|
557
|
+
prompter.outro(lastCode === 0 ? 'Migration completed.' : 'Migration finished with issues.');
|
|
558
|
+
return { status: 'completed', code: lastCode, command: lastCommand, outcome: lastOutcome };
|
|
559
|
+
}
|
|
560
|
+
catch (error) {
|
|
561
|
+
prompter.error(error instanceof Error ? error.message : String(error));
|
|
562
|
+
prompter.outro('Migration failed. Review the printed report or diagnostic, then rerun the wizard.');
|
|
563
|
+
return { status: 'completed', code: 2, command: lastCommand };
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
prompter.outro('Migration wizard finished after dry-run.');
|
|
567
|
+
return { status: 'completed', code: lastCode, command: lastCommand, outcome: lastOutcome };
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
catch (error) {
|
|
572
|
+
if (!(error instanceof WizardCancelledError))
|
|
573
|
+
throw error;
|
|
574
|
+
prompter.cancel('Interactive migration cancelled; no new operation was started.');
|
|
575
|
+
return { status: 'cancelled', code: 130, ...(lastCommand ? { command: lastCommand } : {}), ...(lastOutcome ? { outcome: lastOutcome } : {}) };
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
//# sourceMappingURL=interactive-migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactive-migrate.js","sourceRoot":"","sources":["../src/interactive-migrate.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,kB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C,CAAC;IAC1I,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CliCommand } from './cli-arguments.js';
|
|
2
|
+
import type { TransferResult } from './migrator.js';
|
|
3
|
+
import type { MigrationReportPaths } from './report.js';
|
|
4
|
+
export type ParsedMigrationCommand = Extract<CliCommand, {
|
|
5
|
+
command: 'migrate';
|
|
6
|
+
}>;
|
|
7
|
+
export type ReadyMigrationCommand = Omit<ParsedMigrationCommand, 'source' | 'destination' | 'interactive'> & {
|
|
8
|
+
source: string;
|
|
9
|
+
destination: string;
|
|
10
|
+
interactive?: false;
|
|
11
|
+
};
|
|
12
|
+
export interface MigrationCommandOutcome {
|
|
13
|
+
code: number;
|
|
14
|
+
result?: TransferResult;
|
|
15
|
+
reportPaths?: MigrationReportPaths;
|
|
16
|
+
workspaceRoot: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function readyMigrationCommand(command: ParsedMigrationCommand): ReadyMigrationCommand;
|
|
19
|
+
export declare function runMigrationCommand(command: ReadyMigrationCommand): Promise<MigrationCommandOutcome>;
|