@treeviz/gedcom-parser 1.0.13 → 1.0.15
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/dist/classes/index.d.ts +2 -28
- package/dist/classes/index.js +6713 -21
- package/dist/classes/index.js.map +1 -0
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js +7826 -24
- package/dist/cli/index.js.map +1 -0
- package/dist/constants/index.d.ts +49 -4
- package/dist/constants/index.js +5797 -4
- package/dist/constants/index.js.map +1 -0
- package/dist/factories/index.d.ts +202 -13
- package/dist/factories/index.js +5782 -8
- package/dist/factories/index.js.map +1 -0
- package/dist/index-BvW-KWJP.d.ts +1654 -0
- package/dist/index.d.ts +9 -28
- package/dist/index.js +7380 -35
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.d.ts +2 -12
- package/dist/interfaces/index.js +3 -1
- package/dist/interfaces/index.js.map +1 -0
- package/dist/kinship-translator/index.d.ts +146 -11
- package/dist/kinship-translator/index.js +5727 -9
- package/dist/kinship-translator/index.js.map +1 -0
- package/dist/place-parser-RlXCXZ8F.d.ts +37 -0
- package/dist/structures/index.d.ts +25 -27
- package/dist/structures/index.js +3 -1
- package/dist/structures/index.js.map +1 -0
- package/dist/types/index.d.ts +69 -8
- package/dist/types/index.js +31 -6
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +91 -18
- package/dist/utils/index.js +6953 -17
- package/dist/utils/index.js.map +1 -0
- package/package.json +4 -3
- package/dist/classes/common.d.ts +0 -91
- package/dist/classes/common.d.ts.map +0 -1
- package/dist/classes/common.js +0 -488
- package/dist/classes/date.d.ts +0 -27
- package/dist/classes/date.d.ts.map +0 -1
- package/dist/classes/date.js +0 -178
- package/dist/classes/fam.d.ts +0 -19
- package/dist/classes/fam.d.ts.map +0 -1
- package/dist/classes/fam.js +0 -38
- package/dist/classes/fams.d.ts +0 -16
- package/dist/classes/fams.d.ts.map +0 -1
- package/dist/classes/fams.js +0 -41
- package/dist/classes/gedcom.d.ts +0 -139
- package/dist/classes/gedcom.d.ts.map +0 -1
- package/dist/classes/gedcom.js +0 -910
- package/dist/classes/index.d.ts.map +0 -1
- package/dist/classes/indi.d.ts +0 -323
- package/dist/classes/indi.d.ts.map +0 -1
- package/dist/classes/indi.js +0 -2131
- package/dist/classes/indis.d.ts +0 -55
- package/dist/classes/indis.d.ts.map +0 -1
- package/dist/classes/indis.js +0 -457
- package/dist/classes/list.d.ts +0 -55
- package/dist/classes/list.d.ts.map +0 -1
- package/dist/classes/list.js +0 -440
- package/dist/classes/name.d.ts +0 -20
- package/dist/classes/name.d.ts.map +0 -1
- package/dist/classes/name.js +0 -48
- package/dist/classes/note.d.ts +0 -12
- package/dist/classes/note.d.ts.map +0 -1
- package/dist/classes/note.js +0 -46
- package/dist/classes/obje.d.ts +0 -12
- package/dist/classes/obje.d.ts.map +0 -1
- package/dist/classes/obje.js +0 -81
- package/dist/classes/objes.d.ts +0 -8
- package/dist/classes/objes.d.ts.map +0 -1
- package/dist/classes/objes.js +0 -13
- package/dist/classes/repo.d.ts +0 -11
- package/dist/classes/repo.d.ts.map +0 -1
- package/dist/classes/repo.js +0 -6
- package/dist/classes/repos.d.ts +0 -8
- package/dist/classes/repos.d.ts.map +0 -1
- package/dist/classes/repos.js +0 -13
- package/dist/classes/sour.d.ts +0 -11
- package/dist/classes/sour.d.ts.map +0 -1
- package/dist/classes/sour.js +0 -6
- package/dist/classes/sours.d.ts +0 -8
- package/dist/classes/sours.d.ts.map +0 -1
- package/dist/classes/sours.js +0 -13
- package/dist/classes/subm.d.ts +0 -10
- package/dist/classes/subm.d.ts.map +0 -1
- package/dist/classes/subm.js +0 -6
- package/dist/classes/subms.d.ts +0 -8
- package/dist/classes/subms.d.ts.map +0 -1
- package/dist/classes/subms.js +0 -13
- package/dist/cli/commands/convert.d.ts +0 -3
- package/dist/cli/commands/convert.d.ts.map +0 -1
- package/dist/cli/commands/convert.js +0 -83
- package/dist/cli/commands/extract.d.ts +0 -3
- package/dist/cli/commands/extract.d.ts.map +0 -1
- package/dist/cli/commands/extract.js +0 -85
- package/dist/cli/commands/find.d.ts +0 -3
- package/dist/cli/commands/find.d.ts.map +0 -1
- package/dist/cli/commands/find.js +0 -97
- package/dist/cli/commands/info.d.ts +0 -3
- package/dist/cli/commands/info.d.ts.map +0 -1
- package/dist/cli/commands/info.js +0 -80
- package/dist/cli/commands/merge.d.ts +0 -3
- package/dist/cli/commands/merge.d.ts.map +0 -1
- package/dist/cli/commands/merge.js +0 -61
- package/dist/cli/commands/relatives.d.ts +0 -3
- package/dist/cli/commands/relatives.d.ts.map +0 -1
- package/dist/cli/commands/relatives.js +0 -107
- package/dist/cli/commands/show.d.ts +0 -3
- package/dist/cli/commands/show.d.ts.map +0 -1
- package/dist/cli/commands/show.js +0 -176
- package/dist/cli/commands/stats.d.ts +0 -3
- package/dist/cli/commands/stats.d.ts.map +0 -1
- package/dist/cli/commands/stats.js +0 -59
- package/dist/cli/commands/validate.d.ts +0 -3
- package/dist/cli/commands/validate.d.ts.map +0 -1
- package/dist/cli/commands/validate.js +0 -148
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/utils/formatters.d.ts +0 -69
- package/dist/cli/utils/formatters.d.ts.map +0 -1
- package/dist/cli/utils/formatters.js +0 -125
- package/dist/cli/utils/helpers.d.ts +0 -21
- package/dist/cli/utils/helpers.d.ts.map +0 -1
- package/dist/cli/utils/helpers.js +0 -58
- package/dist/constants/constants.d.ts +0 -14
- package/dist/constants/constants.d.ts.map +0 -1
- package/dist/constants/constants.js +0 -13
- package/dist/constants/filters.d.ts +0 -18
- package/dist/constants/filters.d.ts.map +0 -1
- package/dist/constants/filters.js +0 -44
- package/dist/constants/index.d.ts.map +0 -1
- package/dist/constants/orders.d.ts +0 -17
- package/dist/constants/orders.d.ts.map +0 -1
- package/dist/constants/orders.js +0 -240
- package/dist/factories/cache-factory.d.ts +0 -30
- package/dist/factories/cache-factory.d.ts.map +0 -1
- package/dist/factories/cache-factory.js +0 -43
- package/dist/factories/date-locale-factory.d.ts +0 -30
- package/dist/factories/date-locale-factory.d.ts.map +0 -1
- package/dist/factories/date-locale-factory.js +0 -34
- package/dist/factories/i18n-factory.d.ts +0 -40
- package/dist/factories/i18n-factory.d.ts.map +0 -1
- package/dist/factories/i18n-factory.js +0 -44
- package/dist/factories/index.d.ts.map +0 -1
- package/dist/factories/kinship-factory.d.ts +0 -38
- package/dist/factories/kinship-factory.d.ts.map +0 -1
- package/dist/factories/kinship-factory.js +0 -35
- package/dist/factories/place-parser-provider.d.ts +0 -32
- package/dist/factories/place-parser-provider.d.ts.map +0 -1
- package/dist/factories/place-parser-provider.js +0 -35
- package/dist/factories/place-translator-provider.d.ts +0 -32
- package/dist/factories/place-translator-provider.d.ts.map +0 -1
- package/dist/factories/place-translator-provider.js +0 -35
- package/dist/index.d.ts.map +0 -1
- package/dist/interfaces/common.d.ts +0 -43
- package/dist/interfaces/common.d.ts.map +0 -1
- package/dist/interfaces/common.js +0 -1
- package/dist/interfaces/fam.d.ts +0 -11
- package/dist/interfaces/fam.d.ts.map +0 -1
- package/dist/interfaces/fam.js +0 -1
- package/dist/interfaces/fams.d.ts +0 -9
- package/dist/interfaces/fams.d.ts.map +0 -1
- package/dist/interfaces/fams.js +0 -1
- package/dist/interfaces/gedcom.d.ts +0 -30
- package/dist/interfaces/gedcom.d.ts.map +0 -1
- package/dist/interfaces/gedcom.js +0 -1
- package/dist/interfaces/index.d.ts.map +0 -1
- package/dist/interfaces/indi.d.ts +0 -113
- package/dist/interfaces/indi.d.ts.map +0 -1
- package/dist/interfaces/indi.js +0 -1
- package/dist/interfaces/indis.d.ts +0 -31
- package/dist/interfaces/indis.d.ts.map +0 -1
- package/dist/interfaces/indis.js +0 -1
- package/dist/interfaces/list.d.ts +0 -52
- package/dist/interfaces/list.d.ts.map +0 -1
- package/dist/interfaces/list.js +0 -1
- package/dist/interfaces/obje.d.ts +0 -7
- package/dist/interfaces/obje.d.ts.map +0 -1
- package/dist/interfaces/obje.js +0 -1
- package/dist/interfaces/repo.d.ts +0 -7
- package/dist/interfaces/repo.d.ts.map +0 -1
- package/dist/interfaces/repo.js +0 -1
- package/dist/interfaces/sour.d.ts +0 -7
- package/dist/interfaces/sour.d.ts.map +0 -1
- package/dist/interfaces/sour.js +0 -1
- package/dist/interfaces/subm.d.ts +0 -6
- package/dist/interfaces/subm.d.ts.map +0 -1
- package/dist/interfaces/subm.js +0 -1
- package/dist/kinship-translator/index.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.basic.d.ts +0 -30
- package/dist/kinship-translator/kinship-translator.basic.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.basic.js +0 -74
- package/dist/kinship-translator/kinship-translator.d.ts +0 -26
- package/dist/kinship-translator/kinship-translator.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.de.d.ts +0 -18
- package/dist/kinship-translator/kinship-translator.de.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.de.js +0 -180
- package/dist/kinship-translator/kinship-translator.en.d.ts +0 -18
- package/dist/kinship-translator/kinship-translator.en.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.en.js +0 -182
- package/dist/kinship-translator/kinship-translator.es.d.ts +0 -18
- package/dist/kinship-translator/kinship-translator.es.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.es.js +0 -181
- package/dist/kinship-translator/kinship-translator.fr.d.ts +0 -18
- package/dist/kinship-translator/kinship-translator.fr.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.fr.js +0 -181
- package/dist/kinship-translator/kinship-translator.hu.d.ts +0 -19
- package/dist/kinship-translator/kinship-translator.hu.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.hu.js +0 -226
- package/dist/kinship-translator/kinship-translator.interface.d.ts +0 -19
- package/dist/kinship-translator/kinship-translator.interface.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.interface.js +0 -1
- package/dist/kinship-translator/kinship-translator.js +0 -103
- package/dist/kinship-translator/patterns.de.d.ts +0 -2
- package/dist/kinship-translator/patterns.de.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.de.js +0 -14
- package/dist/kinship-translator/patterns.en.d.ts +0 -2
- package/dist/kinship-translator/patterns.en.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.en.js +0 -14
- package/dist/kinship-translator/patterns.es.d.ts +0 -2
- package/dist/kinship-translator/patterns.es.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.es.js +0 -14
- package/dist/kinship-translator/patterns.fr.d.ts +0 -2
- package/dist/kinship-translator/patterns.fr.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.fr.js +0 -14
- package/dist/kinship-translator/patterns.hu.d.ts +0 -6
- package/dist/kinship-translator/patterns.hu.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.hu.js +0 -97
- package/dist/kinship-translator/translators.d.ts +0 -6
- package/dist/kinship-translator/translators.d.ts.map +0 -1
- package/dist/kinship-translator/translators.js +0 -5
- package/dist/kinship-translator/types.d.ts +0 -9
- package/dist/kinship-translator/types.d.ts.map +0 -1
- package/dist/kinship-translator/types.js +0 -1
- package/dist/structures/address.d.ts +0 -14
- package/dist/structures/address.d.ts.map +0 -1
- package/dist/structures/address.js +0 -1
- package/dist/structures/association.d.ts +0 -13
- package/dist/structures/association.d.ts.map +0 -1
- package/dist/structures/association.js +0 -1
- package/dist/structures/change-date.d.ts +0 -8
- package/dist/structures/change-date.d.ts.map +0 -1
- package/dist/structures/change-date.js +0 -1
- package/dist/structures/creation-date.d.ts +0 -7
- package/dist/structures/creation-date.d.ts.map +0 -1
- package/dist/structures/creation-date.js +0 -1
- package/dist/structures/date.d.ts +0 -9
- package/dist/structures/date.d.ts.map +0 -1
- package/dist/structures/date.js +0 -1
- package/dist/structures/event-detail-structure.d.ts +0 -25
- package/dist/structures/event-detail-structure.d.ts.map +0 -1
- package/dist/structures/event-detail-structure.js +0 -1
- package/dist/structures/family.d.ts +0 -34
- package/dist/structures/family.d.ts.map +0 -1
- package/dist/structures/family.js +0 -1
- package/dist/structures/gedcom.d.ts +0 -59
- package/dist/structures/gedcom.d.ts.map +0 -1
- package/dist/structures/gedcom.js +0 -1
- package/dist/structures/index.d.ts.map +0 -1
- package/dist/structures/individual-event-detail-structure.d.ts +0 -9
- package/dist/structures/individual-event-detail-structure.d.ts.map +0 -1
- package/dist/structures/individual-event-detail-structure.js +0 -1
- package/dist/structures/individual-event-structure.d.ts +0 -83
- package/dist/structures/individual-event-structure.d.ts.map +0 -1
- package/dist/structures/individual-event-structure.js +0 -1
- package/dist/structures/individual.d.ts +0 -40
- package/dist/structures/individual.d.ts.map +0 -1
- package/dist/structures/individual.js +0 -1
- package/dist/structures/lds-ordinance-detail.d.ts +0 -17
- package/dist/structures/lds-ordinance-detail.d.ts.map +0 -1
- package/dist/structures/lds-ordinance-detail.js +0 -1
- package/dist/structures/lds-spouse-sealing.d.ts +0 -7
- package/dist/structures/lds-spouse-sealing.d.ts.map +0 -1
- package/dist/structures/lds-spouse-sealing.js +0 -1
- package/dist/structures/marriage-date.d.ts +0 -11
- package/dist/structures/marriage-date.d.ts.map +0 -1
- package/dist/structures/marriage-date.js +0 -1
- package/dist/structures/multimedia-link.d.ts +0 -16
- package/dist/structures/multimedia-link.d.ts.map +0 -1
- package/dist/structures/multimedia-link.js +0 -1
- package/dist/structures/non-event.d.ts +0 -12
- package/dist/structures/non-event.d.ts.map +0 -1
- package/dist/structures/non-event.js +0 -1
- package/dist/structures/note.d.ts +0 -16
- package/dist/structures/note.d.ts.map +0 -1
- package/dist/structures/note.js +0 -1
- package/dist/structures/personal-name-pieces.d.ts +0 -11
- package/dist/structures/personal-name-pieces.d.ts.map +0 -1
- package/dist/structures/personal-name-pieces.js +0 -1
- package/dist/structures/personal-name.d.ts +0 -16
- package/dist/structures/personal-name.d.ts.map +0 -1
- package/dist/structures/personal-name.js +0 -1
- package/dist/structures/place.d.ts +0 -20
- package/dist/structures/place.d.ts.map +0 -1
- package/dist/structures/place.js +0 -1
- package/dist/structures/repository.d.ts +0 -6
- package/dist/structures/repository.d.ts.map +0 -1
- package/dist/structures/repository.js +0 -1
- package/dist/structures/source-citation.d.ts +0 -27
- package/dist/structures/source-citation.d.ts.map +0 -1
- package/dist/structures/source-citation.js +0 -1
- package/dist/structures/source-repository-citation.d.ts +0 -13
- package/dist/structures/source-repository-citation.d.ts.map +0 -1
- package/dist/structures/source-repository-citation.js +0 -1
- package/dist/structures/source.d.ts +0 -28
- package/dist/structures/source.d.ts.map +0 -1
- package/dist/structures/source.js +0 -1
- package/dist/types/ancestry-media.d.ts +0 -65
- package/dist/types/ancestry-media.d.ts.map +0 -1
- package/dist/types/ancestry-media.js +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/settings.d.ts +0 -12
- package/dist/types/settings.d.ts.map +0 -1
- package/dist/types/settings.js +0 -1
- package/dist/types/types.d.ts +0 -225
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/types.js +0 -26
- package/dist/utils/cache.d.ts +0 -22
- package/dist/utils/cache.d.ts.map +0 -1
- package/dist/utils/cache.js +0 -57
- package/dist/utils/common-creator.d.ts +0 -13
- package/dist/utils/common-creator.d.ts.map +0 -1
- package/dist/utils/common-creator.js +0 -72
- package/dist/utils/date-formatter.d.ts +0 -35
- package/dist/utils/date-formatter.d.ts.map +0 -1
- package/dist/utils/date-formatter.js +0 -207
- package/dist/utils/get-all-prop.d.ts +0 -4
- package/dist/utils/get-all-prop.d.ts.map +0 -1
- package/dist/utils/get-all-prop.js +0 -5
- package/dist/utils/get-family-with.d.ts +0 -5
- package/dist/utils/get-family-with.d.ts.map +0 -1
- package/dist/utils/get-family-with.js +0 -11
- package/dist/utils/get-places.d.ts +0 -21
- package/dist/utils/get-places.d.ts.map +0 -1
- package/dist/utils/get-places.js +0 -77
- package/dist/utils/get-product-details.d.ts +0 -4
- package/dist/utils/get-product-details.d.ts.map +0 -1
- package/dist/utils/get-product-details.js +0 -6
- package/dist/utils/get-raw-size.d.ts +0 -2
- package/dist/utils/get-raw-size.d.ts.map +0 -1
- package/dist/utils/get-raw-size.js +0 -3
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/logger.d.ts +0 -3
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -11
- package/dist/utils/name-formatter.d.ts +0 -10
- package/dist/utils/name-formatter.d.ts.map +0 -1
- package/dist/utils/name-formatter.js +0 -45
- package/dist/utils/nested-group.d.ts +0 -4
- package/dist/utils/nested-group.d.ts.map +0 -1
- package/dist/utils/nested-group.js +0 -34
- package/dist/utils/ordinalize.d.ts +0 -3
- package/dist/utils/ordinalize.d.ts.map +0 -1
- package/dist/utils/ordinalize.js +0 -104
- package/dist/utils/parser.d.ts +0 -17
- package/dist/utils/parser.d.ts.map +0 -1
- package/dist/utils/parser.js +0 -321
- package/dist/utils/place-parser.d.ts +0 -16
- package/dist/utils/place-parser.d.ts.map +0 -1
- package/dist/utils/place-parser.js +0 -46
- package/dist/utils/place-translator.d.ts +0 -6
- package/dist/utils/place-translator.d.ts.map +0 -1
- package/dist/utils/place-translator.js +0 -8
- package/dist/utils/place-types.d.ts +0 -27
- package/dist/utils/place-types.d.ts.map +0 -1
- package/dist/utils/place-types.js +0 -14
- package/dist/utils/range.d.ts +0 -19
- package/dist/utils/range.d.ts.map +0 -1
- package/dist/utils/range.js +0 -265
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { writeFileSync } from 'fs';
|
|
2
|
-
import GedcomTree from '../../utils/parser.js';
|
|
3
|
-
import { formatHeader, formatSuccess, formatListItem, formatJson, formatId, formatName, formatError, } from '../utils/formatters.js';
|
|
4
|
-
import { readGedcomFile, handleError, cleanGedcomName, formatLifespan } from '../utils/helpers.js';
|
|
5
|
-
export function registerRelativesCommand(program) {
|
|
6
|
-
program
|
|
7
|
-
.command('relatives <file> <id>')
|
|
8
|
-
.description('Get ancestors and/or descendants of an individual')
|
|
9
|
-
.option('-a, --ancestors', 'Include ancestors')
|
|
10
|
-
.option('-d, --descendants', 'Include descendants')
|
|
11
|
-
.option('-t, --tree', 'Include both ancestors and descendants')
|
|
12
|
-
.option('--depth <n>', 'Limit depth (generations)', '999')
|
|
13
|
-
.option('-o, --output <file>', 'Save to new GEDCOM file')
|
|
14
|
-
.option('-j, --json', 'Output in JSON format')
|
|
15
|
-
.action((file, id, options) => {
|
|
16
|
-
try {
|
|
17
|
-
const content = readGedcomFile(file);
|
|
18
|
-
const { gedcom: tree } = GedcomTree.parse(content);
|
|
19
|
-
const individual = tree.indi(id);
|
|
20
|
-
if (!individual) {
|
|
21
|
-
console.error(formatError(`Individual ${id} not found`));
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
const maxDepth = parseInt(options.depth || '999', 10);
|
|
25
|
-
const relatives = new Set();
|
|
26
|
-
relatives.add(id);
|
|
27
|
-
// Include both if --tree is specified
|
|
28
|
-
const includeAncestors = options.ancestors || options.tree;
|
|
29
|
-
const includeDescendants = options.descendants || options.tree;
|
|
30
|
-
// Get ancestors
|
|
31
|
-
if (includeAncestors) {
|
|
32
|
-
const getAncestors = (indi, depth) => {
|
|
33
|
-
if (depth > maxDepth)
|
|
34
|
-
return;
|
|
35
|
-
const parents = indi.getParents();
|
|
36
|
-
parents?.forEach(parent => {
|
|
37
|
-
relatives.add(parent.id);
|
|
38
|
-
getAncestors(parent, depth + 1);
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
getAncestors(individual, 1);
|
|
42
|
-
}
|
|
43
|
-
// Get descendants
|
|
44
|
-
if (includeDescendants) {
|
|
45
|
-
const getDescendants = (indi, depth) => {
|
|
46
|
-
if (depth > maxDepth)
|
|
47
|
-
return;
|
|
48
|
-
const children = indi.getChildren();
|
|
49
|
-
children?.forEach(child => {
|
|
50
|
-
relatives.add(child.id);
|
|
51
|
-
getDescendants(child, depth + 1);
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
getDescendants(individual, 1);
|
|
55
|
-
}
|
|
56
|
-
// Get all individuals
|
|
57
|
-
const allRelatives = Array.from(relatives)
|
|
58
|
-
.map(relId => tree.indi(relId))
|
|
59
|
-
.filter(indi => indi !== null);
|
|
60
|
-
if (options.output) {
|
|
61
|
-
// Create a new GEDCOM with only these individuals
|
|
62
|
-
const newContent = createSubsetGedcom(tree, allRelatives);
|
|
63
|
-
writeFileSync(options.output, newContent, 'utf-8');
|
|
64
|
-
console.log(formatSuccess(`Saved ${allRelatives.length} individuals to ${options.output}`));
|
|
65
|
-
}
|
|
66
|
-
else if (options.json) {
|
|
67
|
-
const jsonData = allRelatives.map(indi => ({
|
|
68
|
-
id: indi.id,
|
|
69
|
-
name: cleanGedcomName(indi.NAME?.toValue()),
|
|
70
|
-
birthDate: indi.BIRT?.DATE?.toValue() || null,
|
|
71
|
-
deathDate: indi.DEAT?.DATE?.toValue() || null,
|
|
72
|
-
}));
|
|
73
|
-
console.log(formatJson({ count: jsonData.length, individuals: jsonData }));
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
console.log(formatHeader(`Found ${allRelatives.length} relative(s)\n`));
|
|
77
|
-
allRelatives.forEach(indi => {
|
|
78
|
-
const name = cleanGedcomName(indi.NAME?.toValue());
|
|
79
|
-
const lifespan = formatLifespan(indi.BIRT?.DATE?.toValue(), indi.DEAT?.DATE?.toValue());
|
|
80
|
-
console.log(formatListItem(`${formatId(indi.id)} ${formatName(name)} ${lifespan}`));
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
handleError(error, 'Failed to extract relatives');
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function createSubsetGedcom(tree, individuals) {
|
|
90
|
-
const lines = [];
|
|
91
|
-
// Add header
|
|
92
|
-
lines.push('0 HEAD');
|
|
93
|
-
lines.push('1 SOUR gedcom-parser CLI');
|
|
94
|
-
lines.push('1 GEDC');
|
|
95
|
-
lines.push('2 VERS 5.5.1');
|
|
96
|
-
lines.push('1 CHAR UTF-8');
|
|
97
|
-
// Add individuals
|
|
98
|
-
individuals.forEach(indi => {
|
|
99
|
-
const raw = indi.raw();
|
|
100
|
-
if (raw) {
|
|
101
|
-
lines.push(...raw.split('\n').filter(line => line.trim()));
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
// Add trailer
|
|
105
|
-
lines.push('0 TRLR');
|
|
106
|
-
return lines.join('\n');
|
|
107
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/show.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuBzC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiN1D"}
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import GedcomTree from '../../utils/parser.js';
|
|
2
|
-
import { formatHeader, formatLabel, formatValue, formatListItem, formatJson, formatId, formatName, formatDate, formatPlace, formatError, } from '../utils/formatters.js';
|
|
3
|
-
import { readGedcomFile, handleError, cleanGedcomName, formatLifespan } from '../utils/helpers.js';
|
|
4
|
-
export function registerShowCommand(program) {
|
|
5
|
-
program
|
|
6
|
-
.command('show <file> <id>')
|
|
7
|
-
.description('Display detailed information about an individual')
|
|
8
|
-
.option('-j, --json', 'Output in JSON format')
|
|
9
|
-
.option('-f, --format <format>', 'Output format: text, json, markdown', 'text')
|
|
10
|
-
.option('--include-events', 'Include all life events')
|
|
11
|
-
.option('--include-sources', 'Include sources')
|
|
12
|
-
.action((file, id, options) => {
|
|
13
|
-
try {
|
|
14
|
-
const content = readGedcomFile(file);
|
|
15
|
-
const { gedcom: tree } = GedcomTree.parse(content);
|
|
16
|
-
const individual = tree.indi(id);
|
|
17
|
-
if (!individual) {
|
|
18
|
-
console.error(formatError(`Individual ${id} not found`));
|
|
19
|
-
process.exit(1);
|
|
20
|
-
}
|
|
21
|
-
const name = cleanGedcomName(individual.NAME?.toValue());
|
|
22
|
-
const birthDate = individual.BIRT?.DATE?.toValue();
|
|
23
|
-
const birthPlace = individual.BIRT?.PLAC?.value;
|
|
24
|
-
const deathDate = individual.DEAT?.DATE?.toValue();
|
|
25
|
-
const deathPlace = individual.DEAT?.PLAC?.value;
|
|
26
|
-
const sex = individual.SEX?.value;
|
|
27
|
-
// Get parents
|
|
28
|
-
const parents = individual.getParents();
|
|
29
|
-
const father = parents?.find(p => p.SEX?.value === 'M');
|
|
30
|
-
const mother = parents?.find(p => p.SEX?.value === 'F');
|
|
31
|
-
// Get spouses
|
|
32
|
-
const spouses = individual.getSpouses();
|
|
33
|
-
// Get children
|
|
34
|
-
const children = individual.getChildren();
|
|
35
|
-
if (options.json || options.format === 'json') {
|
|
36
|
-
const jsonData = {
|
|
37
|
-
id: individual.id,
|
|
38
|
-
name,
|
|
39
|
-
sex,
|
|
40
|
-
birth: {
|
|
41
|
-
date: birthDate || null,
|
|
42
|
-
place: birthPlace || null,
|
|
43
|
-
},
|
|
44
|
-
death: {
|
|
45
|
-
date: deathDate || null,
|
|
46
|
-
place: deathPlace || null,
|
|
47
|
-
},
|
|
48
|
-
parents: {
|
|
49
|
-
father: father ? {
|
|
50
|
-
id: father.id,
|
|
51
|
-
name: cleanGedcomName(father.NAME?.toValue()),
|
|
52
|
-
} : null,
|
|
53
|
-
mother: mother ? {
|
|
54
|
-
id: mother.id,
|
|
55
|
-
name: cleanGedcomName(mother.NAME?.toValue()),
|
|
56
|
-
} : null,
|
|
57
|
-
},
|
|
58
|
-
spouses: spouses.map(spouse => ({
|
|
59
|
-
id: spouse.id,
|
|
60
|
-
name: cleanGedcomName(spouse.NAME?.toValue()),
|
|
61
|
-
birthDate: spouse.BIRT?.DATE?.toValue() || null,
|
|
62
|
-
deathDate: spouse.DEAT?.DATE?.toValue() || null,
|
|
63
|
-
})),
|
|
64
|
-
children: children.map(child => ({
|
|
65
|
-
id: child.id,
|
|
66
|
-
name: cleanGedcomName(child.NAME?.toValue()),
|
|
67
|
-
birthDate: child.BIRT?.DATE?.toValue() || null,
|
|
68
|
-
deathDate: child.DEAT?.DATE?.toValue() || null,
|
|
69
|
-
})),
|
|
70
|
-
};
|
|
71
|
-
console.log(formatJson(jsonData));
|
|
72
|
-
}
|
|
73
|
-
else if (options.format === 'markdown') {
|
|
74
|
-
console.log(`# ${formatId(individual.id)} ${name}\n`);
|
|
75
|
-
if (birthDate || birthPlace) {
|
|
76
|
-
console.log(`**Born:** ${birthDate || '?'}`);
|
|
77
|
-
if (birthPlace)
|
|
78
|
-
console.log(` in ${birthPlace}`);
|
|
79
|
-
console.log();
|
|
80
|
-
}
|
|
81
|
-
if (deathDate || deathPlace) {
|
|
82
|
-
console.log(`**Died:** ${deathDate || '?'}`);
|
|
83
|
-
if (deathPlace)
|
|
84
|
-
console.log(` in ${deathPlace}`);
|
|
85
|
-
console.log();
|
|
86
|
-
}
|
|
87
|
-
if (father || mother) {
|
|
88
|
-
console.log('## Parents\n');
|
|
89
|
-
if (father) {
|
|
90
|
-
const fatherName = cleanGedcomName(father.NAME?.toValue());
|
|
91
|
-
const fatherLifespan = formatLifespan(father.BIRT?.DATE?.toValue(), father.DEAT?.DATE?.toValue());
|
|
92
|
-
console.log(`- **Father:** ${father.id} ${fatherName} ${fatherLifespan}`);
|
|
93
|
-
}
|
|
94
|
-
if (mother) {
|
|
95
|
-
const motherName = cleanGedcomName(mother.NAME?.toValue());
|
|
96
|
-
const motherLifespan = formatLifespan(mother.BIRT?.DATE?.toValue(), mother.DEAT?.DATE?.toValue());
|
|
97
|
-
console.log(`- **Mother:** ${mother.id} ${motherName} ${motherLifespan}`);
|
|
98
|
-
}
|
|
99
|
-
console.log();
|
|
100
|
-
}
|
|
101
|
-
if (spouses.length > 0) {
|
|
102
|
-
console.log('## Spouses\n');
|
|
103
|
-
spouses.forEach(spouse => {
|
|
104
|
-
const spouseName = cleanGedcomName(spouse.NAME?.toValue());
|
|
105
|
-
const spouseLifespan = formatLifespan(spouse.BIRT?.DATE?.toValue(), spouse.DEAT?.DATE?.toValue());
|
|
106
|
-
console.log(`- ${spouse.id} ${spouseName} ${spouseLifespan}`);
|
|
107
|
-
});
|
|
108
|
-
console.log();
|
|
109
|
-
}
|
|
110
|
-
if (children.length > 0) {
|
|
111
|
-
console.log('## Children\n');
|
|
112
|
-
children.forEach(child => {
|
|
113
|
-
const childName = cleanGedcomName(child.NAME?.toValue());
|
|
114
|
-
const childLifespan = formatLifespan(child.BIRT?.DATE?.toValue(), child.DEAT?.DATE?.toValue());
|
|
115
|
-
console.log(`- ${child.id} ${childName} ${childLifespan}`);
|
|
116
|
-
});
|
|
117
|
-
console.log();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
// Text format (default)
|
|
122
|
-
console.log(formatHeader(`${formatId(individual.id)} ${formatName(name)}\n`));
|
|
123
|
-
if (sex) {
|
|
124
|
-
console.log(`${formatLabel('Sex')} ${formatValue(sex === 'M' ? 'Male' : sex === 'F' ? 'Female' : sex)}`);
|
|
125
|
-
}
|
|
126
|
-
if (birthDate || birthPlace) {
|
|
127
|
-
console.log(`${formatLabel('Born')} ${formatDate(birthDate)}`);
|
|
128
|
-
if (birthPlace) {
|
|
129
|
-
console.log(`${formatLabel('Birth Place')} ${formatPlace(birthPlace)}`);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (deathDate || deathPlace) {
|
|
133
|
-
console.log(`${formatLabel('Died')} ${formatDate(deathDate)}`);
|
|
134
|
-
if (deathPlace) {
|
|
135
|
-
console.log(`${formatLabel('Death Place')} ${formatPlace(deathPlace)}`);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (father || mother) {
|
|
139
|
-
console.log();
|
|
140
|
-
console.log(formatHeader('Parents'));
|
|
141
|
-
if (father) {
|
|
142
|
-
const fatherName = cleanGedcomName(father.NAME?.toValue());
|
|
143
|
-
const fatherLifespan = formatLifespan(father.BIRT?.DATE?.toValue(), father.DEAT?.DATE?.toValue());
|
|
144
|
-
console.log(formatListItem(`${formatLabel('Father')} ${formatId(father.id)} ${formatName(fatherName)} ${fatherLifespan}`));
|
|
145
|
-
}
|
|
146
|
-
if (mother) {
|
|
147
|
-
const motherName = cleanGedcomName(mother.NAME?.toValue());
|
|
148
|
-
const motherLifespan = formatLifespan(mother.BIRT?.DATE?.toValue(), mother.DEAT?.DATE?.toValue());
|
|
149
|
-
console.log(formatListItem(`${formatLabel('Mother')} ${formatId(mother.id)} ${formatName(motherName)} ${motherLifespan}`));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
if (spouses.length > 0) {
|
|
153
|
-
console.log();
|
|
154
|
-
console.log(formatHeader('Spouses'));
|
|
155
|
-
spouses.forEach(spouse => {
|
|
156
|
-
const spouseName = cleanGedcomName(spouse.NAME?.toValue());
|
|
157
|
-
const spouseLifespan = formatLifespan(spouse.BIRT?.DATE?.toValue(), spouse.DEAT?.DATE?.toValue());
|
|
158
|
-
console.log(formatListItem(`${formatId(spouse.id)} ${formatName(spouseName)} ${spouseLifespan}`));
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
if (children.length > 0) {
|
|
162
|
-
console.log();
|
|
163
|
-
console.log(formatHeader('Children'));
|
|
164
|
-
children.forEach(child => {
|
|
165
|
-
const childName = cleanGedcomName(child.NAME?.toValue());
|
|
166
|
-
const childLifespan = formatLifespan(child.BIRT?.DATE?.toValue(), child.DEAT?.DATE?.toValue());
|
|
167
|
-
console.log(formatListItem(`${formatId(child.id)} ${formatName(childName)} ${childLifespan}`));
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
catch (error) {
|
|
173
|
-
handleError(error, 'Failed to show individual details');
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/stats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAczC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA6D3D"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import GedcomTree from '../../utils/parser.js';
|
|
2
|
-
import { formatHeader, formatLabel, formatCount, formatJson, } from '../utils/formatters.js';
|
|
3
|
-
import { readGedcomFile, handleError } from '../utils/helpers.js';
|
|
4
|
-
export function registerStatsCommand(program) {
|
|
5
|
-
program
|
|
6
|
-
.command('stats <file>')
|
|
7
|
-
.description('Generate statistics about a GEDCOM file')
|
|
8
|
-
.option('-j, --json', 'Output in JSON format')
|
|
9
|
-
.action((file, options) => {
|
|
10
|
-
try {
|
|
11
|
-
const content = readGedcomFile(file);
|
|
12
|
-
const { gedcom: tree } = GedcomTree.parse(content);
|
|
13
|
-
// Use the stats() method from the GedCom class
|
|
14
|
-
const stats = tree.stats();
|
|
15
|
-
if (options.json) {
|
|
16
|
-
console.log(formatJson(stats));
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
console.log(formatHeader('GEDCOM File Statistics\n'));
|
|
20
|
-
console.log(formatLabel('Total Individuals'));
|
|
21
|
-
console.log(` ${formatCount(stats.totalIndividuals)}`);
|
|
22
|
-
console.log(formatLabel('Total Families'));
|
|
23
|
-
console.log(` ${formatCount(stats.totalFamilies)}`);
|
|
24
|
-
console.log();
|
|
25
|
-
console.log(formatLabel('By Gender'));
|
|
26
|
-
console.log(` Males: ${formatCount(stats.byGender.males)}`);
|
|
27
|
-
console.log(` Females: ${formatCount(stats.byGender.females)}`);
|
|
28
|
-
console.log(` Unknown: ${formatCount(stats.byGender.unknown)}`);
|
|
29
|
-
console.log();
|
|
30
|
-
if (stats.dateRange.earliest && stats.dateRange.latest) {
|
|
31
|
-
console.log(formatLabel('Date Range'));
|
|
32
|
-
console.log(` ${stats.dateRange.earliest} - ${stats.dateRange.latest}`);
|
|
33
|
-
console.log();
|
|
34
|
-
}
|
|
35
|
-
if (stats.averageLifespan) {
|
|
36
|
-
console.log(formatLabel('Average Lifespan'));
|
|
37
|
-
console.log(` ${stats.averageLifespan.toFixed(1)} years`);
|
|
38
|
-
console.log();
|
|
39
|
-
}
|
|
40
|
-
if (stats.topSurnames.length > 0) {
|
|
41
|
-
console.log(formatLabel('Most Common Surnames'));
|
|
42
|
-
stats.topSurnames.forEach(({ surname, count }) => {
|
|
43
|
-
console.log(` ${surname}: ${formatCount(count)}`);
|
|
44
|
-
});
|
|
45
|
-
console.log();
|
|
46
|
-
}
|
|
47
|
-
if (stats.topBirthPlaces.length > 0) {
|
|
48
|
-
console.log(formatLabel('Most Common Birth Places'));
|
|
49
|
-
stats.topBirthPlaces.slice(0, 5).forEach(({ place, count }) => {
|
|
50
|
-
console.log(` ${place}: ${formatCount(count)}`);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
handleError(error, 'Failed to generate statistics');
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0BzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqK9D"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import GedcomTree from '../../utils/parser.js';
|
|
2
|
-
import { formatHeader, formatSuccess, formatWarning, formatError, formatListItem, formatJson, formatCount, } from '../utils/formatters.js';
|
|
3
|
-
import { readGedcomFile, handleError } from '../utils/helpers.js';
|
|
4
|
-
export function registerValidateCommand(program) {
|
|
5
|
-
program
|
|
6
|
-
.command('validate <file>')
|
|
7
|
-
.description('Validate a GEDCOM file')
|
|
8
|
-
.option('-j, --json', 'Output in JSON format')
|
|
9
|
-
.option('-s, --strict', 'Enable strict validation')
|
|
10
|
-
.option('--fix', 'Attempt to fix common issues (not implemented)')
|
|
11
|
-
.action((file, options) => {
|
|
12
|
-
try {
|
|
13
|
-
const content = readGedcomFile(file);
|
|
14
|
-
const { gedcom: tree } = GedcomTree.parse(content);
|
|
15
|
-
const errors = [];
|
|
16
|
-
const warnings = [];
|
|
17
|
-
// Get GEDCOM version
|
|
18
|
-
const header = tree.HEAD;
|
|
19
|
-
const version = header?.GEDC?.VERS?.value || 'Unknown';
|
|
20
|
-
// Basic validation checks
|
|
21
|
-
const individuals = tree.indis();
|
|
22
|
-
const families = tree.fams();
|
|
23
|
-
// Check for individuals without names
|
|
24
|
-
let missingNames = 0;
|
|
25
|
-
individuals.forEach(indi => {
|
|
26
|
-
if (!indi.NAME?.toValue()) {
|
|
27
|
-
missingNames++;
|
|
28
|
-
warnings.push(`Individual ${indi.id} is missing a name`);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
// Check for individuals without birth dates
|
|
32
|
-
let missingBirthDates = 0;
|
|
33
|
-
individuals.forEach(indi => {
|
|
34
|
-
if (!indi.BIRT?.DATE?.toValue()) {
|
|
35
|
-
missingBirthDates++;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
// Check for individuals without death dates (but marked as deceased)
|
|
39
|
-
let missingDeathDates = 0;
|
|
40
|
-
individuals.forEach(indi => {
|
|
41
|
-
if (indi.DEAT && !indi.DEAT.DATE?.toValue()) {
|
|
42
|
-
missingDeathDates++;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
// Check for duplicate IDs
|
|
46
|
-
const seenIds = new Set();
|
|
47
|
-
const duplicateIds = [];
|
|
48
|
-
const checkDuplicates = (item) => {
|
|
49
|
-
if (seenIds.has(item.id)) {
|
|
50
|
-
duplicateIds.push(item.id);
|
|
51
|
-
errors.push(`Duplicate ID found: ${item.id}`);
|
|
52
|
-
}
|
|
53
|
-
seenIds.add(item.id);
|
|
54
|
-
};
|
|
55
|
-
individuals.forEach(checkDuplicates);
|
|
56
|
-
families.forEach(checkDuplicates);
|
|
57
|
-
// Check for missing family members
|
|
58
|
-
families.forEach(fam => {
|
|
59
|
-
const husb = fam.HUSB?.value;
|
|
60
|
-
const wife = fam.WIFE?.value;
|
|
61
|
-
if (!husb && !wife) {
|
|
62
|
-
warnings.push(`Family ${fam.id} has no husband or wife`);
|
|
63
|
-
}
|
|
64
|
-
if (husb && !tree.indi(husb)) {
|
|
65
|
-
errors.push(`Family ${fam.id} references non-existent husband ${husb}`);
|
|
66
|
-
}
|
|
67
|
-
if (wife && !tree.indi(wife)) {
|
|
68
|
-
errors.push(`Family ${fam.id} references non-existent wife ${wife}`);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
// Check for invalid date formats (basic check)
|
|
72
|
-
individuals.forEach(indi => {
|
|
73
|
-
const birthDate = indi.BIRT?.DATE?.toValue();
|
|
74
|
-
const deathDate = indi.DEAT?.DATE?.toValue();
|
|
75
|
-
if (birthDate && birthDate.includes('INVALID')) {
|
|
76
|
-
errors.push(`Invalid birth date format for ${indi.id}`);
|
|
77
|
-
}
|
|
78
|
-
if (deathDate && deathDate.includes('INVALID')) {
|
|
79
|
-
errors.push(`Invalid death date format for ${indi.id}`);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
const result = {
|
|
83
|
-
valid: errors.length === 0,
|
|
84
|
-
version,
|
|
85
|
-
errors,
|
|
86
|
-
warnings,
|
|
87
|
-
};
|
|
88
|
-
if (options.json) {
|
|
89
|
-
console.log(formatJson(result));
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
if (result.valid) {
|
|
93
|
-
console.log(formatSuccess(`Valid GEDCOM ${version} file`));
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
console.log(formatError(`Invalid GEDCOM file - ${errors.length} error(s) found`));
|
|
97
|
-
}
|
|
98
|
-
console.log();
|
|
99
|
-
console.log(formatHeader('Validation Summary'));
|
|
100
|
-
console.log(`${formatError('Errors:')} ${formatCount(errors.length)}`);
|
|
101
|
-
console.log(`${formatWarning('Warnings:')} ${formatCount(warnings.length)}`);
|
|
102
|
-
if (errors.length > 0) {
|
|
103
|
-
console.log();
|
|
104
|
-
console.log(formatHeader('Errors'));
|
|
105
|
-
errors.slice(0, 10).forEach(error => {
|
|
106
|
-
console.log(formatListItem(formatError(error)));
|
|
107
|
-
});
|
|
108
|
-
if (errors.length > 10) {
|
|
109
|
-
console.log(formatListItem(`... and ${errors.length - 10} more errors`));
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
if (warnings.length > 0) {
|
|
113
|
-
console.log();
|
|
114
|
-
console.log(formatHeader('Warnings'));
|
|
115
|
-
// Summarize warnings
|
|
116
|
-
if (missingBirthDates > 0) {
|
|
117
|
-
console.log(formatListItem(formatWarning(`Missing birth dates: ${missingBirthDates} individuals`)));
|
|
118
|
-
}
|
|
119
|
-
if (missingDeathDates > 0) {
|
|
120
|
-
console.log(formatListItem(formatWarning(`Missing death dates: ${missingDeathDates} individuals`)));
|
|
121
|
-
}
|
|
122
|
-
if (duplicateIds.length > 0) {
|
|
123
|
-
console.log(formatListItem(formatWarning(`Duplicate IDs: ${duplicateIds.length}`)));
|
|
124
|
-
}
|
|
125
|
-
// Show first few specific warnings
|
|
126
|
-
const otherWarnings = warnings.filter(w => !w.includes('birth') && !w.includes('death'));
|
|
127
|
-
otherWarnings.slice(0, 5).forEach(warning => {
|
|
128
|
-
console.log(formatListItem(formatWarning(warning)));
|
|
129
|
-
});
|
|
130
|
-
if (otherWarnings.length > 5) {
|
|
131
|
-
console.log(formatListItem(`... and ${otherWarnings.length - 5} more warnings`));
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (options.fix) {
|
|
135
|
-
console.log();
|
|
136
|
-
console.log(formatWarning('Fix option is not yet implemented'));
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
// Exit with error code if validation failed
|
|
140
|
-
if (!result.valid) {
|
|
141
|
-
process.exit(1);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
catch (error) {
|
|
145
|
-
handleError(error, 'Failed to validate GEDCOM file');
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
package/dist/cli/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format a success message
|
|
3
|
-
*/
|
|
4
|
-
export declare function formatSuccess(message: string): string;
|
|
5
|
-
/**
|
|
6
|
-
* Format a warning message
|
|
7
|
-
*/
|
|
8
|
-
export declare function formatWarning(message: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* Format an error message
|
|
11
|
-
*/
|
|
12
|
-
export declare function formatError(message: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Format an info message
|
|
15
|
-
*/
|
|
16
|
-
export declare function formatInfo(message: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* Format a header
|
|
19
|
-
*/
|
|
20
|
-
export declare function formatHeader(text: string): string;
|
|
21
|
-
/**
|
|
22
|
-
* Format a field label
|
|
23
|
-
*/
|
|
24
|
-
export declare function formatLabel(label: string): string;
|
|
25
|
-
/**
|
|
26
|
-
* Format a value
|
|
27
|
-
*/
|
|
28
|
-
export declare function formatValue(value: string | number | null | undefined): string;
|
|
29
|
-
/**
|
|
30
|
-
* Format an ID
|
|
31
|
-
*/
|
|
32
|
-
export declare function formatId(id: string): string;
|
|
33
|
-
/**
|
|
34
|
-
* Format a count
|
|
35
|
-
*/
|
|
36
|
-
export declare function formatCount(count: number): string;
|
|
37
|
-
/**
|
|
38
|
-
* Format a date
|
|
39
|
-
*/
|
|
40
|
-
export declare function formatDate(date: string | null | undefined): string;
|
|
41
|
-
/**
|
|
42
|
-
* Format a place
|
|
43
|
-
*/
|
|
44
|
-
export declare function formatPlace(place: string | null | undefined): string;
|
|
45
|
-
/**
|
|
46
|
-
* Format a name
|
|
47
|
-
*/
|
|
48
|
-
export declare function formatName(name: string | null | undefined): string;
|
|
49
|
-
/**
|
|
50
|
-
* Format a list item
|
|
51
|
-
*/
|
|
52
|
-
export declare function formatListItem(text: string, indent?: number): string;
|
|
53
|
-
/**
|
|
54
|
-
* Format a table row
|
|
55
|
-
*/
|
|
56
|
-
export declare function formatTableRow(columns: string[], widths: number[]): string;
|
|
57
|
-
/**
|
|
58
|
-
* Format a table separator
|
|
59
|
-
*/
|
|
60
|
-
export declare function formatTableSeparator(widths: number[]): string;
|
|
61
|
-
/**
|
|
62
|
-
* Pretty print JSON
|
|
63
|
-
*/
|
|
64
|
-
export declare function formatJson(data: unknown): string;
|
|
65
|
-
/**
|
|
66
|
-
* Format a progress indicator
|
|
67
|
-
*/
|
|
68
|
-
export declare function formatProgress(current: number, total: number): string;
|
|
69
|
-
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/formatters.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAK7E;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAKlE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAKpE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAOlE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,MAAM,CAGvE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAI1E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAI7D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAEhD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAKrE"}
|