@iwonz/ywtc 3.2.2 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +12 -4
  3. package/dist/adapters/confluence.d.ts +23 -2
  4. package/dist/adapters/confluence.js +56 -2
  5. package/dist/adapters/confluence.js.map +1 -1
  6. package/dist/adapters/yandex.d.ts +16 -2
  7. package/dist/adapters/yandex.js +49 -4
  8. package/dist/adapters/yandex.js.map +1 -1
  9. package/dist/cli-arguments.d.ts +3 -1
  10. package/dist/cli-arguments.js +4 -0
  11. package/dist/cli-arguments.js.map +1 -1
  12. package/dist/cli.js +11 -6
  13. package/dist/cli.js.map +1 -1
  14. package/dist/clients/confluence-cloud.d.ts +1 -0
  15. package/dist/clients/confluence-cloud.js +7 -0
  16. package/dist/clients/confluence-cloud.js.map +1 -1
  17. package/dist/clients/confluence.d.ts +1 -0
  18. package/dist/clients/confluence.js +1 -0
  19. package/dist/clients/confluence.js.map +1 -1
  20. package/dist/clients/yandex-wiki.d.ts +3 -1
  21. package/dist/clients/yandex-wiki.js +23 -5
  22. package/dist/clients/yandex-wiki.js.map +1 -1
  23. package/dist/content-model.js +3 -2
  24. package/dist/content-model.js.map +1 -1
  25. package/dist/doctor.d.ts +7 -2
  26. package/dist/doctor.js +8 -3
  27. package/dist/doctor.js.map +1 -1
  28. package/dist/domain.d.ts +48 -2
  29. package/dist/domain.js +5 -1
  30. package/dist/domain.js.map +1 -1
  31. package/dist/graph.d.ts +2 -1
  32. package/dist/graph.js +105 -15
  33. package/dist/graph.js.map +1 -1
  34. package/dist/migrator.d.ts +2 -1
  35. package/dist/migrator.js +153 -17
  36. package/dist/migrator.js.map +1 -1
  37. package/dist/report-catalog.d.ts +17 -0
  38. package/dist/report-catalog.js +14 -0
  39. package/dist/report-catalog.js.map +1 -1
  40. package/dist/report.d.ts +23 -2
  41. package/dist/report.js +43 -2
  42. package/dist/report.js.map +1 -1
  43. package/dist/state.d.ts +8 -2
  44. package/dist/state.js +25 -1
  45. package/dist/state.js.map +1 -1
  46. package/dist/types.d.ts +4 -1
  47. package/package.json +1 -1
package/dist/graph.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"graph.js","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAQA,SAAS,eAAe,CAAC,IAAgB,EAAE,KAAiB;IAC1D,OAAO,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,sBAAsB,CAAC,SAAwB;IACtD,IAAI,SAAS,CAAC,IAAI,KAAK,UAAU,IAAI,SAAS,CAAC,IAAI,KAAK,YAAY,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,UAAU,CAAC;IACvH,OAAO,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC;AACrE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,KAMvC;IACC,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAC,GAAG,KAAK,CAAC;IACzD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAqB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACzE,MAAM,KAAK,GAAoB,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,WAAW,GAAG,CAAC,MAAM,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC/E,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;YAC/B,IAAI,MAAM,EAAE,OAAO;gBAAE,MAAM,MAAM,C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IACD,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC3F,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;IAChG,CAAC;IAED,MAAM,SAAS,GAAoB;QACjC,eAAe;QACf,eAAe,EAAE,SAAS,CAAC,eAAe;QAC1C,mBAAmB,EAAE,SAAS,CAAC,QAAQ;QACvC,mBAAmB,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC;QACrC,QAAQ,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAClF,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7D,aAAa;QACb,KAAK,EAAE,SAAS,CAAC,KAAK;KACvB,CAAC;IACF,UAAU,EAAE,CAAC,EAAC,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAC,CAAC,CAAC;IACzD,OAAO,EAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAC,CAAC;AACvE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { createProviderAdapter } from './adapters/factory.js';
2
2
  import type { AppConfig } from './config.js';
3
3
  import { type ConsistencyRetryOptions } from './consistency.js';
4
- import type { TransferScope } from './domain.js';
4
+ import type { SourceStatus, TransferScope } from './domain.js';
5
5
  import type { Logger } from './logger.js';
6
6
  import type { RemoteLocator, ResolvedLocator } from './locators.js';
7
7
  import { type MigrationReportPaths, type TransferReportSummary } from './report.js';
@@ -10,6 +10,7 @@ export interface TransferOptions {
10
10
  source: RemoteLocator;
11
11
  destination: ResolvedLocator;
12
12
  scope: TransferScope;
13
+ sourceStatus?: SourceStatus;
13
14
  dryRun: boolean;
14
15
  archive: boolean;
15
16
  fresh?: boolean;
package/dist/migrator.js CHANGED
@@ -211,11 +211,12 @@ export class Migrator {
211
211
  this.consistencyOptions = consistencyOptions;
212
212
  }
213
213
  async run(options) {
214
+ const sourceStatus = options.sourceStatus ?? 'all';
214
215
  const source = this.adapterFactory(options.source.profile, this.config);
215
216
  const destination = options.destination.type === 'remote'
216
217
  ? this.adapterFactory(options.destination.profile, this.config)
217
218
  : undefined;
218
- assertTransferCapabilities(source, destination, options.scope);
219
+ assertTransferCapabilities(source, destination, options.scope, sourceStatus);
219
220
  const status = options.onStatus ?? (() => undefined);
220
221
  status('Checking source and destination capabilities');
221
222
  const [sourcePlatform, destinationPlatform, root, container] = await Promise.all([
@@ -239,10 +240,11 @@ export class Migrator {
239
240
  await store.load(identity, { fresh: options.fresh ?? false, dryRun: options.dryRun });
240
241
  if (!options.dryRun)
241
242
  await store.save();
242
- const run = await store.beginRun(options.scope, options.dryRun);
243
+ const run = await store.beginRun(options.scope, options.dryRun, sourceStatus);
243
244
  const report = new TransferReport({
244
245
  dryRun: options.dryRun,
245
246
  scope: options.scope,
247
+ sourceStatus,
246
248
  direction: `${source.kind} → ${options.destination.type === 'directory' ? options.destination.format : destination.kind}`,
247
249
  source: { provider: source.kind, profile: source.profile.name, rootId: root.id, title: root.title, url: root.url },
248
250
  destination: options.destination.type === 'directory'
@@ -265,11 +267,14 @@ export class Migrator {
265
267
  adapter: source,
266
268
  root,
267
269
  scope: options.scope,
270
+ sourceStatus,
268
271
  ...(options.signal ? { signal: options.signal } : {}),
269
272
  onProgress: (progress) => status(`Discovery: ${progress.pages} pages, ${progress.edges} links${progress.active ? ` · ${progress.active}` : ''}`),
270
273
  });
271
274
  report.registerPages(graph.pages);
272
275
  report.setEdges(graph.edges);
276
+ report.setSelection(graph.selection);
277
+ await store.setRunSelection(run.id, graph.selection);
273
278
  for (const warning of graph.warnings)
274
279
  report.warning(warning);
275
280
  if (container
@@ -278,6 +283,7 @@ export class Migrator {
278
283
  && graph.pages.some((page) => page.id === container.id)) {
279
284
  throw new Error('The destination page belongs to the selected source graph. Choose a destination outside the transferred graph.');
280
285
  }
286
+ status(`Source tree: root ${root.title} · ${graph.selection.returnedDescendants} descendants returned · ${graph.selection.selectedDescendants} selected · ${graph.selection.excluded.length} excluded · depth ${graph.selection.maximumDepth}`);
281
287
  status(`Caching source content for ${graph.pages.length} pages`);
282
288
  sourceFingerprints = await cacheDiscoveredPages(options.cacheDirectory, graph);
283
289
  await store.setGraph(graph.rootId, graph.edges);
@@ -360,7 +366,7 @@ export class Migrator {
360
366
  });
361
367
  throw new MigrationRunError('Resource preflight failed before destination mutation', reportPaths, stateLocation.filename);
362
368
  }
363
- const planSummary = `Plan ready: ${graph.pages.length} pages · ${inventory.resources} files (${inventory.bytes} known bytes${inventory.unknownSizes > 0 ? ` · ${inventory.unknownSizes} sizes unknown` : ''}) · ${inventory.links} links · ${inventory.images} images · ${inventory.tables} tables (${inventory.grids} grids) · ${inventory.codeBlocks} code blocks`;
369
+ const planSummary = `Plan ready: root + ${graph.selection.selectedDescendants}/${graph.selection.returnedDescendants} descendants (${graph.selection.excluded.length} excluded, depth ${graph.selection.maximumDepth}) · ${graph.pages.length} pages · ${inventory.resources} files (${inventory.bytes} known bytes${inventory.unknownSizes > 0 ? ` · ${inventory.unknownSizes} sizes unknown` : ''}) · ${inventory.links} links · ${inventory.images} images · ${inventory.tables} tables (${inventory.grids} grids) · ${inventory.codeBlocks} code blocks`;
364
370
  status(planSummary);
365
371
  this.logger.info(planSummary);
366
372
  let output;
@@ -568,6 +574,9 @@ export class Migrator {
568
574
  let resourcesForState = saved?.resources ?? {};
569
575
  let previousDestinationIds = saved?.previousDestinationIds ?? [];
570
576
  let mappingRecovered = false;
577
+ const findTitleConflict = (candidateTitle) => destination.findTitleConflict
578
+ ? destination.findTitleConflict(parent, candidateTitle)
579
+ : destination.findChild(parent, candidateTitle);
571
580
  if (saved?.destinationId) {
572
581
  const mapped = destinationFromState(saved, destination);
573
582
  try {
@@ -613,14 +622,31 @@ export class Migrator {
613
622
  }
614
623
  else {
615
624
  let recoveryTitle = title;
616
- if (candidate) {
625
+ let titleConflict = candidate;
626
+ if (!titleConflict && !recoveryLookupFailed) {
627
+ try {
628
+ titleConflict = await findTitleConflict(recoveryTitle);
629
+ }
630
+ catch (lookupError) {
631
+ recoveryLookupFailed = true;
632
+ report.issue({
633
+ code: 'destination-title-lookup-failed',
634
+ severity: 'warning',
635
+ phase: 'page',
636
+ pageId: page.canonicalId,
637
+ retryable: true,
638
+ message: `${page.title}: destination title lookup failed; bootstrap recreation will be attempted with a stable suffix: ${lookupError instanceof Error ? lookupError.message : String(lookupError)}`,
639
+ });
640
+ }
641
+ }
642
+ if (titleConflict || recoveryLookupFailed) {
617
643
  const base = collisionTitle(page);
618
644
  const hash = sha256(page.canonicalId).slice(0, 8);
619
645
  recoveryTitle = base;
620
646
  let sequence = 0;
621
647
  while (!recoveryLookupFailed) {
622
648
  try {
623
- if (!await findRecoveryChild(recoveryTitle))
649
+ if (!await findTitleConflict(recoveryTitle))
624
650
  break;
625
651
  sequence += 1;
626
652
  recoveryTitle = `${base} [${hash}${sequence > 1 ? `-${sequence}` : ''}]`;
@@ -670,6 +696,91 @@ export class Migrator {
670
696
  created = await verifyConfirmedDestinationPage(destination, created, this.consistencyOptions);
671
697
  assertDestinationContent(bootstrap.body, created.content, destination.kind, cachedPage);
672
698
  }
699
+ if (!mappingRecovered && created.parentId !== parent.id) {
700
+ const oldPage = created;
701
+ if (options.dryRun) {
702
+ report.addHierarchyRepair({
703
+ sourceCanonicalId: page.canonicalId,
704
+ mode: destination.capabilities.reparentPages && destination.reparentPage ? 'moved' : 'recreated',
705
+ ...(created.parentId ? { oldParentId: created.parentId } : {}),
706
+ newParentId: parent.id,
707
+ oldDestinationId: created.id,
708
+ newDestinationId: created.id,
709
+ verified: false,
710
+ });
711
+ }
712
+ else if (destination.capabilities.reparentPages && destination.reparentPage) {
713
+ created = await destination.reparentPage({
714
+ page: created,
715
+ parent,
716
+ ...(created.fingerprint ? { expectedFingerprint: created.fingerprint } : {}),
717
+ });
718
+ created = await verifyConfirmedDestinationPage(destination, created, this.consistencyOptions);
719
+ if (created.parentId !== parent.id) {
720
+ throw new Error(`Destination hierarchy verification failed for ${page.title}: expected parent ${parent.id}, received ${created.parentId ?? 'none'}`);
721
+ }
722
+ report.addHierarchyRepair({
723
+ sourceCanonicalId: page.canonicalId,
724
+ mode: 'moved',
725
+ ...(oldPage.parentId ? { oldParentId: oldPage.parentId } : {}),
726
+ newParentId: parent.id,
727
+ oldDestinationId: oldPage.id,
728
+ newDestinationId: created.id,
729
+ verified: true,
730
+ });
731
+ report.issue({
732
+ code: 'destination-hierarchy-repaired',
733
+ severity: 'normalization',
734
+ phase: 'page',
735
+ pageId: page.canonicalId,
736
+ retryable: false,
737
+ message: `${page.title}: moved destination page ${created.id} from parent ${oldPage.parentId ?? 'none'} to ${parent.id} and verified the hierarchy`,
738
+ });
739
+ }
740
+ else {
741
+ let replacement = await destination.findChild(parent, title);
742
+ const replacementMatches = replacement
743
+ && sourceDerivedTextMatches(bootstrap.body, replacement.content, destination.kind, cachedPage);
744
+ const titleConflict = replacementMatches ? undefined : replacement ?? await findTitleConflict(title);
745
+ if (titleConflict) {
746
+ const base = collisionTitle(page);
747
+ const hash = sha256(page.canonicalId).slice(0, 8);
748
+ title = base;
749
+ let sequence = 0;
750
+ while (await findTitleConflict(title)) {
751
+ sequence += 1;
752
+ title = `${base} [${hash}${sequence > 1 ? `-${sequence}` : ''}]`;
753
+ }
754
+ replacement = undefined;
755
+ }
756
+ created = replacement ?? await destination.createPage({ container: parent, title, body: bootstrap.body });
757
+ created = await verifyConfirmedDestinationPage(destination, created, this.consistencyOptions);
758
+ assertDestinationContent(bootstrap.body, created.content, destination.kind, cachedPage);
759
+ if (created.parentId !== parent.id) {
760
+ throw new Error(`Destination hierarchy verification failed for recreated page ${page.title}: expected parent ${parent.id}, received ${created.parentId ?? 'none'}`);
761
+ }
762
+ previousDestinationIds = [...new Set([...previousDestinationIds, oldPage.id])];
763
+ resourcesForState = resetResourceDestinations(saved.resources);
764
+ mappingRecovered = true;
765
+ report.addHierarchyRepair({
766
+ sourceCanonicalId: page.canonicalId,
767
+ mode: 'recreated',
768
+ ...(oldPage.parentId ? { oldParentId: oldPage.parentId } : {}),
769
+ newParentId: parent.id,
770
+ oldDestinationId: oldPage.id,
771
+ newDestinationId: created.id,
772
+ verified: true,
773
+ });
774
+ report.issue({
775
+ code: 'destination-hierarchy-recreated',
776
+ severity: 'normalization',
777
+ phase: 'page',
778
+ pageId: page.canonicalId,
779
+ retryable: false,
780
+ message: `${page.title}: created verified replacement ${created.id} below ${parent.id}; previous page ${oldPage.id} was left untouched`,
781
+ });
782
+ }
783
+ }
673
784
  }
674
785
  else if (options.dryRun) {
675
786
  created = {
@@ -680,25 +791,45 @@ export class Migrator {
680
791
  title,
681
792
  url: container.url,
682
793
  locator: `dry-run:${page.id}`,
794
+ parentId: parent.id,
683
795
  content: bootstrap.body,
684
796
  contentLength: Buffer.byteLength(bootstrap.body),
685
797
  ...(container.space ? { space: container.space } : {}),
686
798
  };
687
799
  }
688
800
  else {
689
- if (await destination.findChild(parent, title)) {
690
- const base = collisionTitle(page);
691
- const hash = sha256(page.canonicalId).slice(0, 8);
692
- title = base;
693
- let sequence = 0;
694
- while (await destination.findChild(parent, title)) {
695
- sequence += 1;
696
- title = `${base} [${hash}${sequence > 1 ? `-${sequence}` : ''}]`;
801
+ const existingChild = await destination.findChild(parent, title);
802
+ if (existingChild && sourceDerivedTextMatches(bootstrap.body, existingChild.content, destination.kind, cachedPage)) {
803
+ created = existingChild;
804
+ mappingRecovered = true;
805
+ report.issue({
806
+ code: 'destination-unmapped-page-recovered',
807
+ severity: 'normalization',
808
+ phase: 'page',
809
+ pageId: page.canonicalId,
810
+ retryable: false,
811
+ message: `${page.title}: adopted an existing source-derived page below the expected parent`,
812
+ });
813
+ }
814
+ else {
815
+ const titleConflict = existingChild ?? await findTitleConflict(title);
816
+ if (titleConflict) {
817
+ const base = collisionTitle(page);
818
+ const hash = sha256(page.canonicalId).slice(0, 8);
819
+ title = base;
820
+ let sequence = 0;
821
+ while (await findTitleConflict(title)) {
822
+ sequence += 1;
823
+ title = `${base} [${hash}${sequence > 1 ? `-${sequence}` : ''}]`;
824
+ }
697
825
  }
826
+ created = await destination.createPage({ container: parent, title, body: bootstrap.body });
827
+ created = await verifyConfirmedDestinationPage(destination, created, this.consistencyOptions);
828
+ assertDestinationContent(bootstrap.body, created.content, destination.kind, cachedPage);
698
829
  }
699
- created = await destination.createPage({ container: parent, title, body: bootstrap.body });
700
- created = await verifyConfirmedDestinationPage(destination, created, this.consistencyOptions);
701
- assertDestinationContent(bootstrap.body, created.content, destination.kind, cachedPage);
830
+ }
831
+ if (!options.dryRun && created.parentId !== parent.id) {
832
+ throw new Error(`Destination hierarchy verification failed for ${page.title}: expected parent ${parent.id}, received ${created.parentId ?? 'none'}`);
702
833
  }
703
834
  destinationPages.set(page.canonicalId, created);
704
835
  const next = {
@@ -805,7 +936,9 @@ export class Migrator {
805
936
  await store.setPage({ ...state, status: 'partial', lastError: detail, updatedAt: new Date().toISOString() });
806
937
  };
807
938
  try {
808
- let remoteResources = options.dryRun ? [] : await destination.listUploadedResources(destinationPage);
939
+ let remoteResources = options.dryRun || transferableResources.length === 0
940
+ ? []
941
+ : await destination.listUploadedResources(destinationPage);
809
942
  const nameAllocator = new DestinationNameAllocator(remoteResources.map((resource) => resource.name));
810
943
  for (const resourceState of Object.values(state.resources)) {
811
944
  if (resourceState.status === 'complete')
@@ -1004,6 +1137,9 @@ export class Migrator {
1004
1137
  };
1005
1138
  const rendered = await renderRemoteDocument({ destination, container, document, page: cachedPage, context });
1006
1139
  if (rendered.degraded && !options.dryRun) {
1140
+ if (transferableResources.length === 0) {
1141
+ remoteResources = await destination.listUploadedResources(destinationPage);
1142
+ }
1007
1143
  const extension = page.rawFormat === 'yfm' ? 'yfm' : 'storage.xml';
1008
1144
  const snapshotName = `ywtc-source-${sha256(page.canonicalId).slice(0, 8)}.${extension}`;
1009
1145
  const snapshotPath = path.join(options.cacheDirectory, 'snapshots', snapshotName);