strom-research 1.32.0-beta.1 → 1.32.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.cs.md +8 -4
- package/CHANGELOG.de.md +8 -4
- package/CHANGELOG.md +8 -4
- package/CHANGELOG.pl.md +8 -4
- package/assets/lang/cs.json +24 -17
- package/assets/lang/de.json +24 -17
- package/assets/lang/pl.json +24 -17
- package/dist/agents/files.js +18 -8
- package/dist/agents/global.js +8 -3
- package/dist/cli/execute.js +13 -0
- package/dist/cli/help.js +2 -2
- package/dist/cli/ui.js +24 -17
- package/dist/commands/analysis.js +1 -1
- package/dist/commands/guide.js +12 -6
- package/dist/commands/index.js +1 -1
- package/dist/commands/{facts.js → query.js} +158 -80
- package/dist/commands/start.js +1 -1
- package/dist/core/{facts.js → query.js} +134 -5
- package/dist/core/searchtext.js +1 -1
- package/dist/core/tree.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.cs.md
CHANGED
|
@@ -7,9 +7,9 @@ Změny každé verze ve zkratce. Úplné poznámky a instalační řádky jsou n
|
|
|
7
7
|
|
|
8
8
|
## 1.32.0
|
|
9
9
|
|
|
10
|
-
*Připravuje se: bety do 1.32.0-beta.
|
|
10
|
+
*Připravuje se: bety do 1.32.0-beta.2. Oddíl bude úplný s vydáním.*
|
|
11
11
|
|
|
12
|
-
- **Otázky nad rodokmenem jedním voláním: `strom
|
|
12
|
+
- **Otázky nad rodokmenem jedním voláním: `strom query`.** Kolik mlynářů je v rodu, kdo žil v čísle 12, kdo se
|
|
13
13
|
narodil ve Lhotě v 18. století: řádek za každý údaj osoby s hodnotou, místem, číslem popisným, datem, jistotou
|
|
14
14
|
a prameny. Filtry podle druhu, povolání, hodnoty, místa, čísla, let, příjmení (i jeho dalších tvarů), pramene a stavu;
|
|
15
15
|
čí údaje: přímá linie, pokrevní příbuzní (výchozí, i boční větve), i s partnery, nebo celý strom. `--count`
|
|
@@ -19,8 +19,12 @@ Změny každé verze ve zkratce. Úplné poznámky a instalační řádky jsou n
|
|
|
19
19
|
jak to říká kalkulačka vztahů aplikace Strom.
|
|
20
20
|
- **Povolání i v českých, německých, latinských a polských tvarech:** mlynar najde i Müller a molitor; osoby se slovem
|
|
21
21
|
jen ve jméně nebo poznámce se počítají zvlášť, se `strom find`, který je najde.
|
|
22
|
-
- **
|
|
23
|
-
|
|
22
|
+
- **I vyprávění: `strom query --story <slovo>`** vypíše osoby a páry, v jejichž vyprávění slovo je, každou s větou
|
|
23
|
+
a prameny, o které se opírá, se stejnými filtry, počty i skupinami.
|
|
24
|
+
- **Agent odpovídá na otázky nad rodokmenem příkazem `strom query`,** se jménem a ID osoby v závorce (aby šla otevřít v
|
|
25
|
+
aplikaci Strom), celým vztahem a pramenem jeho názvem, a říká, jak jistý je každý údaj: vodítko ani pravděpodobný údaj
|
|
26
|
+
nikdy jako fakt. Vyprávění jen ukazuje, kde hledat; čí je zápis, kdo je kdo a ověřování údajů jde dál jako dosud, z
|
|
27
|
+
pramenů.
|
|
24
28
|
- **Číslo domu zapsané i se slovem** (č. 7, Nr. 7) už nemá slovo dvakrát, ani na kartě osoby.
|
|
25
29
|
- **`strom app --person P…`** otevře aplikaci Strom na této osobě stromu (aplikace před 3.21 otevře strom).
|
|
26
30
|
|
package/CHANGELOG.de.md
CHANGED
|
@@ -7,9 +7,9 @@ Die Änderungen jeder Version in Kürze. Die vollständigen Hinweise und die Ins
|
|
|
7
7
|
|
|
8
8
|
## 1.32.0
|
|
9
9
|
|
|
10
|
-
*In Vorbereitung: die Betas bis 1.32.0-beta.
|
|
10
|
+
*In Vorbereitung: die Betas bis 1.32.0-beta.2. Der Abschnitt ist mit dem Release vollständig.*
|
|
11
11
|
|
|
12
|
-
- **Fragen an den Stammbaum mit einem Aufruf: `strom
|
|
12
|
+
- **Fragen an den Stammbaum mit einem Aufruf: `strom query`.** Wie viele Müller es in der Familie gibt, wer im Haus 12
|
|
13
13
|
wohnte, wer im 18. Jahrhundert in Lhota geboren wurde: eine Zeile je Angabe einer Person mit Wert, Ort, Hausnummer,
|
|
14
14
|
Datum, Sicherheit und Quellen. Filter nach Art, Beruf, Wert, Ort, Hausnummer, Jahren, Nachname (auch seinen anderen
|
|
15
15
|
Formen), Quelle und Status; wessen Angaben: die direkte Linie, die Blutsverwandten (Standard, auch Seitenlinien), mit
|
|
@@ -20,8 +20,12 @@ Die Änderungen jeder Version in Kürze. Die vollständigen Hinweise und die Ins
|
|
|
20
20
|
- **Berufe auch in ihren tschechischen, deutschen, lateinischen und polnischen Formen:** mlynar findet auch Müller und
|
|
21
21
|
molitor; Personen mit dem Wort nur im Namen oder in einer Notiz werden getrennt gezählt, mit dem `strom find`, das sie
|
|
22
22
|
findet.
|
|
23
|
-
- **
|
|
24
|
-
|
|
23
|
+
- **Auch die Erzählungen: `strom query --story <Wort>`** nennt die Personen und Paare, in deren Erzählung das Wort
|
|
24
|
+
steht, jede mit dem Satz und den Quellen, auf die er sich stützt, mit denselben Filtern, Zählungen und Gruppen.
|
|
25
|
+
- **Der Agent beantwortet Fragen an den Stammbaum mit `strom query`,** mit dem Namen und der ID jeder Person in Klammern
|
|
26
|
+
(zum Öffnen in der Strom-App), der ganzen Verwandtschaft und der Quelle mit ihrem Titel, und sagt, wie sicher jede
|
|
27
|
+
Angabe ist: ein Hinweis oder eine wahrscheinliche Angabe nie als Tatsache. Eine Erzählung zeigt nur, wo zu suchen ist;
|
|
28
|
+
wem ein Eintrag gehört, wer wer ist und das Prüfen der Angaben geht weiter wie bisher, aus den Quellen.
|
|
25
29
|
- **Eine Hausnummer mit eigenem Wort** (č. 7, Nr. 7) zeigt das Wort nicht mehr doppelt, auch auf der Karte einer Person.
|
|
26
30
|
- **`strom app --person P…`** öffnet die Strom-App bei dieser Person des Baums (eine App vor 3.21 öffnet den Baum).
|
|
27
31
|
|
package/CHANGELOG.md
CHANGED
|
@@ -7,9 +7,9 @@ The changes of each version in short. The full notes and the install lines are o
|
|
|
7
7
|
|
|
8
8
|
## 1.32.0
|
|
9
9
|
|
|
10
|
-
*In preparation: the betas up to 1.32.0-beta.
|
|
10
|
+
*In preparation: the betas up to 1.32.0-beta.2. The section is complete with the release.*
|
|
11
11
|
|
|
12
|
-
- **Questions over the family tree in one call: `strom
|
|
12
|
+
- **Questions over the family tree in one call: `strom query`.** How many millers in the family, who lived at house 12,
|
|
13
13
|
who was born in Lhota in the 18th century: one row per fact of a person with its value, place, house, date, how sure
|
|
14
14
|
it is and its sources. Filters by kind, occupation, value, place, house, years, surname (its other forms too), source
|
|
15
15
|
and status; whose facts: the direct line, the blood relatives (the default, side branches too), with their partners,
|
|
@@ -19,8 +19,12 @@ The changes of each version in short. The full notes and the install lines are o
|
|
|
19
19
|
father's, the mother's) and the generation, as the Strom app's relationship finder says it.
|
|
20
20
|
- **Occupations in their Czech, German, Latin and Polish forms:** mlynar finds Müller and molitor too; people with the
|
|
21
21
|
word only in a name or a note are counted apart, with the `strom find` that finds them.
|
|
22
|
-
- **The
|
|
23
|
-
|
|
22
|
+
- **The stories too: `strom query --story <word>`** gives the people and couples whose story holds the word, each with
|
|
23
|
+
the sentence and the sources it rests on, with the same filters, counts and groups.
|
|
24
|
+
- **The agent answers questions over the tree with `strom query`,** with each person's name and ID in brackets (to open
|
|
25
|
+
them in the Strom app), the relation whole and the source by its title, and says how sure each fact is: a lead or a
|
|
26
|
+
probable one never as a fact. A story only shows where to look; whose a record is, who a person is and verifying facts
|
|
27
|
+
go on as before, from the records.
|
|
24
28
|
- **A house written with its own word** (č. 7, Nr. 7) no longer shows the word twice, on a person's card too.
|
|
25
29
|
- **`strom app --person P…`** opens the Strom app on that person of the tree (an app before 3.21 opens the tree).
|
|
26
30
|
|
package/CHANGELOG.pl.md
CHANGED
|
@@ -7,9 +7,9 @@ Zmiany każdej wersji w skrócie. Pełne informacje o wydaniach i polecenia inst
|
|
|
7
7
|
|
|
8
8
|
## 1.32.0
|
|
9
9
|
|
|
10
|
-
*W przygotowaniu: bety do 1.32.0-beta.
|
|
10
|
+
*W przygotowaniu: bety do 1.32.0-beta.2. Sekcja będzie kompletna z wydaniem.*
|
|
11
11
|
|
|
12
|
-
- **Pytania o drzewo jednym wywołaniem: `strom
|
|
12
|
+
- **Pytania o drzewo jednym wywołaniem: `strom query`.** Ilu młynarzy jest w rodzie, kto mieszkał pod numerem 12, kto
|
|
13
13
|
urodził się w Lhocie w XVIII wieku: wiersz na każdą daną osoby z wartością, miejscem, numerem domu, datą, pewnością
|
|
14
14
|
i źródłami. Filtry według rodzaju, zawodu, wartości, miejsca, numeru domu, lat, nazwiska (także jego innych form),
|
|
15
15
|
źródła i stanu; czyje dane: linia prosta, krewni (domyślnie, także linie boczne), z ich partnerami, albo całe drzewo.
|
|
@@ -19,8 +19,12 @@ Zmiany każdej wersji w skrócie. Pełne informacje o wydaniach i polecenia inst
|
|
|
19
19
|
i pokoleniem, tak jak mówi kalkulator pokrewieństwa aplikacji Strom.
|
|
20
20
|
- **Zawody także w formach czeskich, niemieckich, łacińskich i polskich:** mlynar znajduje też Müller i molitor; osoby
|
|
21
21
|
ze słowem tylko w nazwisku lub notatce liczone są osobno, z `strom find`, który je znajduje.
|
|
22
|
-
- **
|
|
23
|
-
|
|
22
|
+
- **Także opowieści: `strom query --story <słowo>`** podaje osoby i pary, w których opowieści jest to słowo, każdą
|
|
23
|
+
ze zdaniem i źródłami, na których się opiera, z tymi samymi filtrami, liczeniem i grupami.
|
|
24
|
+
- **Agent odpowiada na pytania o drzewo poleceniem `strom query`,** z imieniem i ID osoby w nawiasie (by otworzyć ją w
|
|
25
|
+
aplikacji Strom), pełnym pokrewieństwem i źródłem z jego tytułem, i mówi, jak pewna jest każda dana: wskazówka ani
|
|
26
|
+
dana prawdopodobna nigdy jako fakt. Opowieść pokazuje tylko, gdzie szukać; czyj jest zapis, kto jest kim i sprawdzanie
|
|
27
|
+
danych idą dalej jak dotąd, ze źródeł.
|
|
24
28
|
- **Numer domu zapisany z własnym słowem** (č. 7, Nr. 7) nie ma już słowa dwa razy, także na karcie osoby.
|
|
25
29
|
- **`strom app --person P…`** otwiera aplikację Strom na tej osobie drzewa (aplikacja przed 3.21 otwiera drzewo).
|
|
26
30
|
|
package/assets/lang/cs.json
CHANGED
|
@@ -1274,22 +1274,27 @@
|
|
|
1274
1274
|
"ui.show.removed.mark": "(odebráno)",
|
|
1275
1275
|
"ui.show.relof": "{rel} u {who}",
|
|
1276
1276
|
"ui.show.eventOf": "{id} – {who} (celý záznam: strom {type} show {owner})",
|
|
1277
|
-
"ui.
|
|
1278
|
-
"ui.
|
|
1279
|
-
"ui.
|
|
1280
|
-
"ui.
|
|
1281
|
-
"ui.
|
|
1282
|
-
"ui.
|
|
1283
|
-
"ui.
|
|
1284
|
-
"ui.
|
|
1285
|
-
"ui.
|
|
1286
|
-
"ui.
|
|
1287
|
-
"ui.
|
|
1288
|
-
"ui.
|
|
1289
|
-
"ui.
|
|
1290
|
-
"ui.
|
|
1291
|
-
"ui.
|
|
1292
|
-
"ui.
|
|
1277
|
+
"ui.query.kin.ancestors": "{of} a předkové",
|
|
1278
|
+
"ui.query.kin.blood": "pokrevní příbuzní osoby {of}",
|
|
1279
|
+
"ui.query.kin.family": "příbuzní osoby {of} a jejich partneři",
|
|
1280
|
+
"ui.query.kin.all": "celý strom, vztahy k osobě {of}",
|
|
1281
|
+
"ui.query.place": "místo {place}",
|
|
1282
|
+
"ui.query.house": "čp. {house}",
|
|
1283
|
+
"ui.query.surname": "příjmení {surname}",
|
|
1284
|
+
"ui.query.source": "pramen {source}",
|
|
1285
|
+
"ui.query.count": "{people, plural, one {# osoba} few {# osoby} many {# osoby} other {# osob}}, {facts, plural, one {# údaj} few {# údaje} many {# údaje} other {# údajů}}",
|
|
1286
|
+
"ui.query.self": "výchozí osoba",
|
|
1287
|
+
"ui.query.unrelated": "bez příbuzenského vztahu",
|
|
1288
|
+
"ui.query.unknown": "neznámo",
|
|
1289
|
+
"ui.query.side": "boční větve",
|
|
1290
|
+
"ui.query.elsewhere": "+{n, plural, one {# osoba} few {# osoby} many {# osoby} other {# osob}} se slovem jen jinde (jméno, poznámka…): {command}",
|
|
1291
|
+
"ui.query.none": "nic nenalezeno: {query}",
|
|
1292
|
+
"ui.query.try": "dál zkusit: {commands}",
|
|
1293
|
+
"ui.query.story": "vyprávění {words}",
|
|
1294
|
+
"ui.query.count.stories": "{people, plural, one {# osoba} few {# osoby} many {# osoby} other {# osob}}, {stories, plural, one {# vyprávění} few {# vyprávění} many {# vyprávění} other {# vyprávění}}",
|
|
1295
|
+
"ui.query.story.snippet": "vyprávění: „{text}“",
|
|
1296
|
+
"ui.query.story.draft": "koncept",
|
|
1297
|
+
"ui.query.story.all": "prameny celého vyprávění: {list}",
|
|
1293
1298
|
"ui.event.edited": "upraveno: {line}",
|
|
1294
1299
|
"ui.show.sex.M": "muž",
|
|
1295
1300
|
"ui.show.sex.F": "žena",
|
|
@@ -1382,7 +1387,7 @@
|
|
|
1382
1387
|
"ui.help.cmd.person.list": "Osoby v rodokmenu",
|
|
1383
1388
|
"ui.help.cmd.pedigree": "Předkové osoby jako strom",
|
|
1384
1389
|
"ui.help.cmd.find": "Najít osobu, záznam nebo místo podle jména",
|
|
1385
|
-
"ui.help.cmd.
|
|
1390
|
+
"ui.help.cmd.query": "Kolik, kdo, kde, kdy: údaje rodu podle povolání, místa, let nebo pramene, i s příbuzenským vztahem každé osoby",
|
|
1386
1391
|
"ui.help.cmd.doc": "Jak Strom funguje: pravidla výzkumu a aplikace podle čísla nebo slov",
|
|
1387
1392
|
"ui.help.cmd.app": "Otevřít výzkum v aplikaci Strom",
|
|
1388
1393
|
"ui.help.cmd.app.install": "Nainstalovat aplikaci Strom z prohlížeče",
|
|
@@ -3087,6 +3092,8 @@
|
|
|
3087
3092
|
"ui.error.command.unknown.hint": "strom help (všechny příkazy)",
|
|
3088
3093
|
"ui.error.command.unknown.person": "neznámý příkaz „strom {cmd}“",
|
|
3089
3094
|
"ui.error.command.unknown.person.hint": "strom help --human – nebo jen {strom}: menu",
|
|
3095
|
+
"ui.error.command.renamed": "„strom {old}“ je teď „strom {now}“ (stejné přepínače)",
|
|
3096
|
+
"ui.error.command.renamed.hint": "{call}",
|
|
3090
3097
|
"ui.error.option.near": "neznámá volba {opt} u {cmd}",
|
|
3091
3098
|
"ui.error.option.near.hint": "podobná volba: {near}",
|
|
3092
3099
|
"ui.conflict.none": "žádné otevřené rozpory",
|
package/assets/lang/de.json
CHANGED
|
@@ -1274,22 +1274,27 @@
|
|
|
1274
1274
|
"ui.show.removed.mark": "(entfernt)",
|
|
1275
1275
|
"ui.show.relof": "{rel} bei {who}",
|
|
1276
1276
|
"ui.show.eventOf": "{id} – {who} (der ganze Eintrag: strom {type} show {owner})",
|
|
1277
|
-
"ui.
|
|
1278
|
-
"ui.
|
|
1279
|
-
"ui.
|
|
1280
|
-
"ui.
|
|
1281
|
-
"ui.
|
|
1282
|
-
"ui.
|
|
1283
|
-
"ui.
|
|
1284
|
-
"ui.
|
|
1285
|
-
"ui.
|
|
1286
|
-
"ui.
|
|
1287
|
-
"ui.
|
|
1288
|
-
"ui.
|
|
1289
|
-
"ui.
|
|
1290
|
-
"ui.
|
|
1291
|
-
"ui.
|
|
1292
|
-
"ui.
|
|
1277
|
+
"ui.query.kin.ancestors": "{of} und die Vorfahren",
|
|
1278
|
+
"ui.query.kin.blood": "Blutsverwandte von {of}",
|
|
1279
|
+
"ui.query.kin.family": "Verwandte von {of} und ihre Partner",
|
|
1280
|
+
"ui.query.kin.all": "der ganze Stammbaum, Beziehungen zu {of}",
|
|
1281
|
+
"ui.query.place": "Ort {place}",
|
|
1282
|
+
"ui.query.house": "Haus Nr. {house}",
|
|
1283
|
+
"ui.query.surname": "Nachname {surname}",
|
|
1284
|
+
"ui.query.source": "Quelle {source}",
|
|
1285
|
+
"ui.query.count": "{people, plural, one {# Person} other {# Personen}}, {facts, plural, one {# Angabe} other {# Angaben}}",
|
|
1286
|
+
"ui.query.self": "Ausgangsperson",
|
|
1287
|
+
"ui.query.unrelated": "nicht verwandt",
|
|
1288
|
+
"ui.query.unknown": "unbekannt",
|
|
1289
|
+
"ui.query.side": "Seitenlinien",
|
|
1290
|
+
"ui.query.elsewhere": "+{n, plural, one {# Person} other {# Personen}} mit dem Wort nur anderswo (Name, Notiz …): {command}",
|
|
1291
|
+
"ui.query.none": "nichts gefunden: {query}",
|
|
1292
|
+
"ui.query.try": "weiter: {commands}",
|
|
1293
|
+
"ui.query.story": "Erzählung {words}",
|
|
1294
|
+
"ui.query.count.stories": "{people, plural, one {# Person} other {# Personen}}, {stories, plural, one {# Erzählung} other {# Erzählungen}}",
|
|
1295
|
+
"ui.query.story.snippet": "Erzählung: „{text}“",
|
|
1296
|
+
"ui.query.story.draft": "Entwurf",
|
|
1297
|
+
"ui.query.story.all": "Quellen der ganzen Erzählung: {list}",
|
|
1293
1298
|
"ui.event.edited": "geändert: {line}",
|
|
1294
1299
|
"ui.show.sex.M": "Mann",
|
|
1295
1300
|
"ui.show.sex.F": "Frau",
|
|
@@ -1382,7 +1387,7 @@
|
|
|
1382
1387
|
"ui.help.cmd.person.list": "Die Personen des Stammbaums",
|
|
1383
1388
|
"ui.help.cmd.pedigree": "Die Vorfahren einer Person als Baum",
|
|
1384
1389
|
"ui.help.cmd.find": "Eine Person, einen Eintrag oder einen Ort nach dem Namen finden",
|
|
1385
|
-
"ui.help.cmd.
|
|
1390
|
+
"ui.help.cmd.query": "Wie viele, wer, wo, wann: die Angaben der Familie nach Beruf, Ort, Jahren oder Quelle, mit dem Verwandtschaftsgrad jeder Person",
|
|
1386
1391
|
"ui.help.cmd.doc": "Wie Strom funktioniert: die Regeln der Forschung und der App, nach Nummer oder Wörtern",
|
|
1387
1392
|
"ui.help.cmd.app": "Die Forschung in der Strom-App öffnen",
|
|
1388
1393
|
"ui.help.cmd.app.install": "Die Strom-App aus dem Browser installieren",
|
|
@@ -3087,6 +3092,8 @@
|
|
|
3087
3092
|
"ui.error.command.unknown.hint": "strom help (alle Befehle)",
|
|
3088
3093
|
"ui.error.command.unknown.person": "unbekannter Befehl „strom {cmd}“",
|
|
3089
3094
|
"ui.error.command.unknown.person.hint": "strom help --human – oder nur {strom}: das Menü",
|
|
3095
|
+
"ui.error.command.renamed": "„strom {old}“ heißt jetzt „strom {now}“ (dieselben Optionen)",
|
|
3096
|
+
"ui.error.command.renamed.hint": "{call}",
|
|
3090
3097
|
"ui.error.option.near": "unbekannte Option {opt} für {cmd}",
|
|
3091
3098
|
"ui.error.option.near.hint": "ähnliche Option: {near}",
|
|
3092
3099
|
"ui.conflict.none": "keine offenen Widersprüche",
|
package/assets/lang/pl.json
CHANGED
|
@@ -1274,22 +1274,27 @@
|
|
|
1274
1274
|
"ui.show.removed.mark": "(usunięte)",
|
|
1275
1275
|
"ui.show.relof": "{rel} przy {who}",
|
|
1276
1276
|
"ui.show.eventOf": "{id} – {who} (cały zapis: strom {type} show {owner})",
|
|
1277
|
-
"ui.
|
|
1278
|
-
"ui.
|
|
1279
|
-
"ui.
|
|
1280
|
-
"ui.
|
|
1281
|
-
"ui.
|
|
1282
|
-
"ui.
|
|
1283
|
-
"ui.
|
|
1284
|
-
"ui.
|
|
1285
|
-
"ui.
|
|
1286
|
-
"ui.
|
|
1287
|
-
"ui.
|
|
1288
|
-
"ui.
|
|
1289
|
-
"ui.
|
|
1290
|
-
"ui.
|
|
1291
|
-
"ui.
|
|
1292
|
-
"ui.
|
|
1277
|
+
"ui.query.kin.ancestors": "{of} i przodkowie",
|
|
1278
|
+
"ui.query.kin.blood": "krewni osoby {of}",
|
|
1279
|
+
"ui.query.kin.family": "krewni osoby {of} i ich partnerzy",
|
|
1280
|
+
"ui.query.kin.all": "całe drzewo, pokrewieństwo z {of}",
|
|
1281
|
+
"ui.query.place": "miejscowość {place}",
|
|
1282
|
+
"ui.query.house": "nr domu {house}",
|
|
1283
|
+
"ui.query.surname": "nazwisko {surname}",
|
|
1284
|
+
"ui.query.source": "źródło {source}",
|
|
1285
|
+
"ui.query.count": "{people, plural, one {# osoba} few {# osoby} many {# osób} other {# osoby}}, {facts, plural, one {# fakt} few {# fakty} many {# faktów} other {# faktu}}",
|
|
1286
|
+
"ui.query.self": "osoba wyjściowa",
|
|
1287
|
+
"ui.query.unrelated": "bez pokrewieństwa",
|
|
1288
|
+
"ui.query.unknown": "nieznane",
|
|
1289
|
+
"ui.query.side": "linie boczne",
|
|
1290
|
+
"ui.query.elsewhere": "+{n, plural, one {# osoba} few {# osoby} many {# osób} other {# osoby}} ze słowem tylko gdzie indziej (nazwisko, notatka…): {command}",
|
|
1291
|
+
"ui.query.none": "nic nie znaleziono: {query}",
|
|
1292
|
+
"ui.query.try": "dalej: {commands}",
|
|
1293
|
+
"ui.query.story": "opowieść {words}",
|
|
1294
|
+
"ui.query.count.stories": "{people, plural, one {# osoba} few {# osoby} many {# osób} other {# osoby}}, {stories, plural, one {# opowieść} few {# opowieści} many {# opowieści} other {# opowieści}}",
|
|
1295
|
+
"ui.query.story.snippet": "opowieść: „{text}”",
|
|
1296
|
+
"ui.query.story.draft": "szkic",
|
|
1297
|
+
"ui.query.story.all": "źródła całej opowieści: {list}",
|
|
1293
1298
|
"ui.event.edited": "zmieniono: {line}",
|
|
1294
1299
|
"ui.show.sex.M": "mężczyzna",
|
|
1295
1300
|
"ui.show.sex.F": "kobieta",
|
|
@@ -1382,7 +1387,7 @@
|
|
|
1382
1387
|
"ui.help.cmd.person.list": "Osoby w drzewie",
|
|
1383
1388
|
"ui.help.cmd.pedigree": "Przodkowie osoby w formie drzewa",
|
|
1384
1389
|
"ui.help.cmd.find": "Znaleźć osobę, zapis albo miejsce według nazwy",
|
|
1385
|
-
"ui.help.cmd.
|
|
1390
|
+
"ui.help.cmd.query": "Ilu, kto, gdzie, kiedy: dane rodu według zawodu, miejsca, lat lub źródła, z pokrewieństwem każdej osoby",
|
|
1386
1391
|
"ui.help.cmd.doc": "Jak działa Strom: zasady badania i aplikacji według numeru albo słów",
|
|
1387
1392
|
"ui.help.cmd.app": "Otworzyć badanie w aplikacji Strom",
|
|
1388
1393
|
"ui.help.cmd.app.install": "Zainstalować aplikację Strom z przeglądarki",
|
|
@@ -3087,6 +3092,8 @@
|
|
|
3087
3092
|
"ui.error.command.unknown.hint": "strom help (wszystkie polecenia)",
|
|
3088
3093
|
"ui.error.command.unknown.person": "nieznane polecenie „strom {cmd}”",
|
|
3089
3094
|
"ui.error.command.unknown.person.hint": "strom help --human – albo po prostu {strom}: menu",
|
|
3095
|
+
"ui.error.command.renamed": "„strom {old}” to teraz „strom {now}” (te same opcje)",
|
|
3096
|
+
"ui.error.command.renamed.hint": "{call}",
|
|
3090
3097
|
"ui.error.option.near": "nieznana opcja {opt} przy {cmd}",
|
|
3091
3098
|
"ui.error.option.near.hint": "podobna opcja: {near}",
|
|
3092
3099
|
"ui.conflict.none": "brak otwartych sprzeczności",
|
package/dist/agents/files.js
CHANGED
|
@@ -81,13 +81,7 @@ the researcher; \`strom\` is your only way to read and change the research.
|
|
|
81
81
|
\`strom media view B0001:57 --half left\` writes one to \`.strom/views/\`;
|
|
82
82
|
the views of a scan or a batch come in one call (\`B0001:57-60 --half both\`).
|
|
83
83
|
A text in those files: \`strom grep "<text>"\` (each line with its file and
|
|
84
|
-
number) — never read a big file in pieces.
|
|
85
|
-
where or when (millers in the family, who lived at house 12): one
|
|
86
|
-
\`strom facts\` call with filters (\`--occupation mlynar --count --by
|
|
87
|
-
generation\`), never \`find\` and \`show\` person by person; answer with the
|
|
88
|
-
people's IDs, the relation and the source (S…), and how sure each fact
|
|
89
|
-
is: only a proven one is told as a fact; probable, possible and a lead
|
|
90
|
-
are not proven — say so, never as a fact.
|
|
84
|
+
number) — never read a big file in pieces.
|
|
91
85
|
7. Run strom commands on their own — no pipes (\`| head\`, \`| grep\`), no
|
|
92
86
|
redirection (\`2>&1\`), no \`cd\` before them: output is already short,
|
|
93
87
|
listings take \`--limit\` and \`--page\`, and such commands may be refused by
|
|
@@ -138,7 +132,8 @@ the researcher; \`strom\` is your only way to read and change the research.
|
|
|
138
132
|
|
|
139
133
|
The user watches this conversation and is usually not technical. Talk in
|
|
140
134
|
${lang}, plainly: say "the baptism of Karel in 1782", not record IDs, unless
|
|
141
|
-
they ask
|
|
135
|
+
they ask, or ask a question over the data (below: the ID in brackets after
|
|
136
|
+
each name). (Working alone — a session of strom run — nobody watches: this
|
|
142
137
|
section is a conversation's; nothing there is said to the user, and its brief
|
|
143
138
|
says how it ends.)
|
|
144
139
|
|
|
@@ -181,6 +176,21 @@ ${hypotheses}
|
|
|
181
176
|
\`strom review P… P…\`; those no record of their own proves ("who has no
|
|
182
177
|
source?"): \`strom person list --unproven\`, then \`strom review --unproven\`
|
|
183
178
|
(a batch at a time).
|
|
179
|
+
- **Questions over the data** ("how many millers were in the family?", "who
|
|
180
|
+
lived at house 12?"): one \`strom query\` call with filters
|
|
181
|
+
(\`--occupation mlynar --count --by generation\`; the stories holding a
|
|
182
|
+
word: \`--story mlyn\`), never \`find\` and \`show\` person by person for
|
|
183
|
+
such a question; answer with each person's name and their ID in brackets
|
|
184
|
+
after it (Karel Lhoták (P0012) — so it opens in the app: \`strom app
|
|
185
|
+
--person P…\`), the relation in words whole as \`strom query\` gives it,
|
|
186
|
+
never shortened, the source by its title with its S… in brackets, and how
|
|
187
|
+
sure each fact is: only a proven one is told as a fact;
|
|
188
|
+
probable, possible and a lead are not proven — say so, never as a fact. A
|
|
189
|
+
story retells the facts: answer from the facts and sources, a story only
|
|
190
|
+
shows where to look. \`strom query\` answers them and shows where to look;
|
|
191
|
+
whose a record is, who a person is, verifying and writing facts go as ever
|
|
192
|
+
(\`strom person show\`, the sources, the method) — a row of it is not
|
|
193
|
+
enough for that.
|
|
184
194
|
- **Their edits in the Strom app** ("I fixed grandma's birthday in the
|
|
185
195
|
app", a .ged or .json they exported): \`strom sync <file>\` shows what it
|
|
186
196
|
would take — tell them, write it on their yes (\`--apply\`); a sync is
|
package/dist/agents/global.js
CHANGED
|
@@ -86,10 +86,15 @@ mentions strom, a family tree or the Strom app.
|
|
|
86
86
|
then works offline); \`strom app\` opens it — with the research, followed
|
|
87
87
|
live while you work, when the app can take it. Without it, the user can ask
|
|
88
88
|
you about anyone in the tree: answer from \`strom person show\` and the like;
|
|
89
|
-
how many, who, where, when (millers in the family): \`strom
|
|
90
|
-
filters
|
|
89
|
+
how many, who, where, when (millers in the family): \`strom query\` with
|
|
90
|
+
filters; each person's name with their ID in brackets after it, the
|
|
91
|
+
relation in words whole as query gives it, never shortened, the source by
|
|
92
|
+
its title with its S… in brackets; only a
|
|
91
93
|
proven fact is told as a fact, probable, possible and a lead are said to
|
|
92
|
-
be unproven
|
|
94
|
+
be unproven; a story (\`--story <word>\`) retells the facts, only shows
|
|
95
|
+
where to look — \`strom app --person P…\` opens one in the app. It
|
|
96
|
+
answers; whose a record is, verifying and writing facts go as ever
|
|
97
|
+
(\`strom person show\`, the sources, the method).
|
|
93
98
|
`;
|
|
94
99
|
/**
|
|
95
100
|
* The rules that let the agent run strom without asking, in its own settings' words.
|
package/dist/cli/execute.js
CHANGED
|
@@ -88,6 +88,10 @@ export function resolveCommand(argv) {
|
|
|
88
88
|
const leftover = found ? words.slice(found.used) : words;
|
|
89
89
|
// Words that are not options — the values of global options (--lang en) are no stray words.
|
|
90
90
|
const extra = rest.filter((r, i) => !r.startsWith("-") && !VALUE_GLOBALS.has(rest[i - 1] ?? ""));
|
|
91
|
+
// a command strom renamed, called by its old name (rules an agent read before, a conversation older than the update):
|
|
92
|
+
// the same call under its new name, never run for it
|
|
93
|
+
if (words.length === 0 && extra[0] !== undefined && Object.hasOwn(RENAMED, extra[0]))
|
|
94
|
+
throw renamedCommand(argv, extra[0]);
|
|
91
95
|
if (found && leftover.length === 0) {
|
|
92
96
|
if (found.def.path.length === 0 && extra.length && rest[0] !== "--")
|
|
93
97
|
throw unknownCommand(extra.slice(0, 2));
|
|
@@ -105,6 +109,15 @@ export function resolveCommand(argv) {
|
|
|
105
109
|
}
|
|
106
110
|
throw unknownCommand([...words, ...extra].slice(0, Math.max(words.length + 1, 2)));
|
|
107
111
|
}
|
|
112
|
+
/** Commands strom renamed: the old name → the new one, which takes the same options. */
|
|
113
|
+
const RENAMED = { facts: "query" };
|
|
114
|
+
/** A renamed command called by its old name: the same call under the new name, to run as it is. */
|
|
115
|
+
function renamedCommand(argv, old) {
|
|
116
|
+
const now = RENAMED[old];
|
|
117
|
+
const at = argv.indexOf(old);
|
|
118
|
+
const call = ["strom", ...argv.map((a, i) => (i === at ? now : shellArg(a)))].join(" ");
|
|
119
|
+
return new UsageError(`"strom ${old}" is now "strom ${now}" (the same options)`, { hint: call, code: "command.renamed", params: { old, now, call } });
|
|
120
|
+
}
|
|
108
121
|
/** Signal: a group name alone — the caller prints the group's short help. */
|
|
109
122
|
export class GroupOnly extends Error {
|
|
110
123
|
group;
|
package/dist/cli/help.js
CHANGED
|
@@ -30,7 +30,7 @@ const ARCHIVE_COMMANDS = new Set([
|
|
|
30
30
|
"init", "trees", "trees use", "trees remove", "trees forget", "mode", "lang", "pack", "unpack", "seal adopt", "seal accept", "backup", "sync", "sync undo", "sync discard",
|
|
31
31
|
"intake", "input list", "input show", "conflict list", "conflict show", "conflict resolve",
|
|
32
32
|
"person list", "person show", "person card", "family show", "source list", "source show", "media list", "media show",
|
|
33
|
-
"find", "
|
|
33
|
+
"find", "query", "stats", "pedigree", "recent", "history", "history back", "doc",
|
|
34
34
|
"export gedcom", "gedcom validate", "app", "app install", "live", "live start", "live stop",
|
|
35
35
|
"check", "verify", "repair", "repair undo", "seal adopt", "seal accept", "fixes", "fixes show", "fixes run", "fixes decline", "fixes reopen", "fixes undo",
|
|
36
36
|
"phone", "phone status", "phone on", "phone qr", "phone off", "phone list", "phone remove",
|
|
@@ -230,7 +230,7 @@ export const HUMAN_COMMANDS = [
|
|
|
230
230
|
"chat", "run", "session finish", "research new", "research pause", "research resume", "research done", "research edit", "research order", "research move", "review", "verify bulk", "verify stop",
|
|
231
231
|
"intake", "sync", "sync undo", "sync discard", "conflict list", "conflict resolve", "conflict leave", "event revert", "person revert", "hypothesis decide", "task list", "task wake", "task order", "story approve", "story discard",
|
|
232
232
|
"offline list", "offline show", "offline set", "offline answer",
|
|
233
|
-
"stats", "recent", "plan", "history", "history back", "person card", "person list", "pedigree", "find", "
|
|
233
|
+
"stats", "recent", "plan", "history", "history back", "person card", "person list", "pedigree", "find", "query", "doc",
|
|
234
234
|
"app", "app install", "live", "live start", "live stop", "phone", "phone on", "phone qr", "phone off", "export gedcom", "pack", "unpack", "seal adopt", "seal accept", "repair undo", "backup", "tidy", "check",
|
|
235
235
|
"fixes", "fixes show", "fixes run", "fixes decline", "fixes reopen", "fixes undo", "fixes review", "media calibrate",
|
|
236
236
|
"surname accept", "surname reject", "surname group", "surname ungroup", "surname unreject", "quality dismiss", "quality undo", "place answer", "place undo", "source split",
|
package/dist/cli/ui.js
CHANGED
|
@@ -1016,22 +1016,27 @@ export const UI = {
|
|
|
1016
1016
|
"ui.show.removed.mark": "(retracted)",
|
|
1017
1017
|
"ui.show.relof": "{rel} of {who}",
|
|
1018
1018
|
"ui.show.eventOf": "{id} of {who} (the whole record: strom {type} show {owner})",
|
|
1019
|
-
"ui.
|
|
1020
|
-
"ui.
|
|
1021
|
-
"ui.
|
|
1022
|
-
"ui.
|
|
1023
|
-
"ui.
|
|
1024
|
-
"ui.
|
|
1025
|
-
"ui.
|
|
1026
|
-
"ui.
|
|
1027
|
-
"ui.
|
|
1028
|
-
"ui.
|
|
1029
|
-
"ui.
|
|
1030
|
-
"ui.
|
|
1031
|
-
"ui.
|
|
1032
|
-
"ui.
|
|
1033
|
-
"ui.
|
|
1034
|
-
"ui.
|
|
1019
|
+
"ui.query.kin.ancestors": "{of} and the ancestors",
|
|
1020
|
+
"ui.query.kin.blood": "blood relatives of {of}",
|
|
1021
|
+
"ui.query.kin.family": "relatives of {of} and their partners",
|
|
1022
|
+
"ui.query.kin.all": "everyone in the tree, related to {of}",
|
|
1023
|
+
"ui.query.place": "place {place}",
|
|
1024
|
+
"ui.query.house": "house {house}",
|
|
1025
|
+
"ui.query.surname": "surname {surname}",
|
|
1026
|
+
"ui.query.source": "source {source}",
|
|
1027
|
+
"ui.query.count": "{people, plural, one {# person} other {# people}}, {facts, plural, one {# fact} other {# facts}}",
|
|
1028
|
+
"ui.query.self": "self",
|
|
1029
|
+
"ui.query.unrelated": "not related",
|
|
1030
|
+
"ui.query.unknown": "unknown",
|
|
1031
|
+
"ui.query.side": "side branches",
|
|
1032
|
+
"ui.query.elsewhere": "+{n, plural, one {# person} other {# people}} with the word only elsewhere (a name, a note, …): {command}",
|
|
1033
|
+
"ui.query.none": "nothing found: {query}",
|
|
1034
|
+
"ui.query.try": "try: {commands}",
|
|
1035
|
+
"ui.query.story": "story {words}",
|
|
1036
|
+
"ui.query.count.stories": "{people, plural, one {# person} other {# people}}, {stories, plural, one {# story} other {# stories}}",
|
|
1037
|
+
"ui.query.story.snippet": "story: “{text}”",
|
|
1038
|
+
"ui.query.story.draft": "draft",
|
|
1039
|
+
"ui.query.story.all": "the story's sources: {list}",
|
|
1035
1040
|
"ui.event.edited": "edited: {line}",
|
|
1036
1041
|
"ui.show.sex.M": "man",
|
|
1037
1042
|
"ui.show.sex.F": "woman",
|
|
@@ -1124,7 +1129,7 @@ export const UI = {
|
|
|
1124
1129
|
"ui.help.cmd.person.list": "The people of the family tree",
|
|
1125
1130
|
"ui.help.cmd.pedigree": "The ancestors of a person as a tree",
|
|
1126
1131
|
"ui.help.cmd.find": "Find a person, a record or a place by its name",
|
|
1127
|
-
"ui.help.cmd.
|
|
1132
|
+
"ui.help.cmd.query": "How many, who, where, when: the facts of the family by occupation, place, years or source, with how each person is related",
|
|
1128
1133
|
"ui.help.cmd.doc": "How Strom works: the rules of the research and the app, by number or by words",
|
|
1129
1134
|
"ui.help.cmd.app": "Open the research in the Strom app",
|
|
1130
1135
|
"ui.help.cmd.app.install": "Install the Strom app from the browser",
|
|
@@ -2932,6 +2937,8 @@ export const UI = {
|
|
|
2932
2937
|
"ui.error.command.unknown.hint": "strom help (all commands)",
|
|
2933
2938
|
"ui.error.command.unknown.person": "unknown command \"strom {cmd}\"",
|
|
2934
2939
|
"ui.error.command.unknown.person.hint": "strom help --human — or just {strom}: the menu",
|
|
2940
|
+
"ui.error.command.renamed": "\"strom {old}\" is now \"strom {now}\" (the same options)",
|
|
2941
|
+
"ui.error.command.renamed.hint": "{call}",
|
|
2935
2942
|
"ui.error.option.near": "unknown option {opt} for {cmd}",
|
|
2936
2943
|
"ui.error.option.near.hint": "similar option: {near}",
|
|
2937
2944
|
"ui.conflict.none": "no open conflicts",
|
|
@@ -1282,7 +1282,7 @@ register({
|
|
|
1282
1282
|
group: "analysis",
|
|
1283
1283
|
tree: true,
|
|
1284
1284
|
description: "Words in one argument must all be there. Several arguments are several searches in one go (e.g. old codes\nof a converted research) — each answered on its own.\n" +
|
|
1285
|
-
"A word in any text (a name, a note); the facts recorded of people (how many millers, who lived at house 12,\nwho is related how): strom
|
|
1285
|
+
"A word in any text (a name, a note); the facts recorded of people (how many millers, who lived at house 12,\nwho is related how): strom query.",
|
|
1286
1286
|
args: [{ name: "text", description: "words to find (diacritics optional); several arguments = several searches", required: true, variadic: true }],
|
|
1287
1287
|
options: [{ name: "type", type: "string", value: "<type>", description: `only one record type: ${Object.keys(RECORD_TYPES).join(", ")}`, aliases: ["kind"] }],
|
|
1288
1288
|
examples: ['strom find "čp. 12"', "strom find mlynar --type source", "strom find \"č. 12\" \"č. 15\" mlynar"],
|
package/dist/commands/guide.js
CHANGED
|
@@ -279,13 +279,19 @@ FINDING YOUR WAY
|
|
|
279
279
|
a text in the research's own files, line by line (accents
|
|
280
280
|
optional) — never Read a big input in pieces
|
|
281
281
|
the user asks how many, who, where, when (millers in the family, who lived at house 12): one call,
|
|
282
|
-
never find and show person by person — strom
|
|
283
|
-
strom
|
|
284
|
-
find: a word in any text;
|
|
285
|
-
(--kin: ancestors, blood the default, family, all). Answer with
|
|
286
|
-
|
|
282
|
+
never find and show person by person — strom query --occupation mlynar --count --by generation ·
|
|
283
|
+
strom query --place Lhota --house 12 --years 1750-1850 --kin family · strom query --source S0001.
|
|
284
|
+
find: a word in any text; query: what is recorded of a person, with the relation to the main person
|
|
285
|
+
(--kin: ancestors, blood the default, family, all). Answer with each person's name and their ID in
|
|
286
|
+
brackets after it (Karel Lhoták (P0012)), the relation in words whole as query gives it, never
|
|
287
|
+
shortened, the source by its title with its S… in brackets, and say how sure each fact is (its
|
|
288
|
+
status): only a proven one is told as a fact;
|
|
287
289
|
probable, possible and a lead are not proven — say so ("probably", "a lead, not proven yet"), never
|
|
288
|
-
as a fact; strom app --person P0001 opens one in the Strom app
|
|
290
|
+
as a fact; strom app --person P0001 opens one in the Strom app. The stories holding a word:
|
|
291
|
+
strom query --story mlyn — a story retells the facts: answer from the facts and their sources, a
|
|
292
|
+
story only shows where to look. query answers the user and shows where to look; whose a record is,
|
|
293
|
+
who a person is, verifying and writing facts go as ever (strom person show, the sources, the method)
|
|
294
|
+
— a row of query is not enough for it.
|
|
289
295
|
for the user, in the research language: strom stats (how far the research got) · strom recent
|
|
290
296
|
(what came in lately) · strom plan (what you do next) · strom pedigree [P…] (the ancestors as a
|
|
291
297
|
tree) · strom person card P… (one life)
|
package/dist/commands/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// strom
|
|
1
|
+
// strom query — the facts of the tree as rows, for questions over the data ("how many millers in the family", "who
|
|
2
2
|
// lived in house 12", "the births of a surname in a century"): one call gives who (with the relation to the main
|
|
3
3
|
// person in words, the side and the generation), what, where, when, how sure and on what source — counted and grouped
|
|
4
4
|
// when asked. Read only (core/facts.ts). strom find stays the search of any text.
|
|
@@ -7,7 +7,7 @@ import { counted, lines, LIST_PAGE_MAX, moreLine, paginate, shellArg, truncate }
|
|
|
7
7
|
import { ui } from "../cli/ui.js";
|
|
8
8
|
import { eventName, humanDate, humanPlace, statusName } from "../cli/human.js";
|
|
9
9
|
import { UsageError } from "../core/errors.js";
|
|
10
|
-
import { ASKED_STATUSES, FACT_GROUPS, KIN_SETS, factKind, findFacts, groupRows, parseYears, personLabel, termLang } from "../core/
|
|
10
|
+
import { ASKED_STATUSES, FACT_GROUPS, KIN_SETS, factKind, findFacts, findStories, groupRows, parseYears, personLabel, termLang } from "../core/query.js";
|
|
11
11
|
import { houseHasWord } from "../core/house.js";
|
|
12
12
|
import { mainPerson } from "../core/kin.js";
|
|
13
13
|
import { displayName, lifespan, resolvePerson } from "../core/people.js";
|
|
@@ -17,7 +17,7 @@ import { relationText } from "../core/relation.js";
|
|
|
17
17
|
import { personUrl, treeUrl } from "../core/widget.js";
|
|
18
18
|
import { wordsFor } from "./people.js";
|
|
19
19
|
const WIDER = { ancestors: "blood", blood: "family", family: "all", all: undefined };
|
|
20
|
-
/** The English words of a set (an agent's text); a person reads them in the research's language (ui.
|
|
20
|
+
/** The English words of a set (an agent's text); a person reads them in the research's language (ui.query.kin.*). */
|
|
21
21
|
const KIN_EN = {
|
|
22
22
|
ancestors: "{of} and the ancestors",
|
|
23
23
|
blood: "blood relatives of {of}",
|
|
@@ -29,7 +29,7 @@ function oneOf(value, allowed, name) {
|
|
|
29
29
|
return undefined;
|
|
30
30
|
const v = String(value).trim().toLowerCase();
|
|
31
31
|
if (!allowed.includes(v))
|
|
32
|
-
throw new UsageError(`--${name} takes ${allowed.join(", ")}`, { hint: `strom
|
|
32
|
+
throw new UsageError(`--${name} takes ${allowed.join(", ")}`, { hint: `strom query --${name} ${allowed[0]}` });
|
|
33
33
|
return v;
|
|
34
34
|
}
|
|
35
35
|
/** The person the relations are to: --of, else the main person; never a retracted one. */
|
|
@@ -37,11 +37,11 @@ function ofPerson(tree, ref) {
|
|
|
37
37
|
const id = typeof ref === "string" && ref.trim() ? resolvePerson(tree, ref).id : mainPerson(tree);
|
|
38
38
|
if (!id)
|
|
39
39
|
throw new UsageError("no main person to relate the facts to", {
|
|
40
|
-
hint: "strom config set main.person P0001 (the person the tree is for), or strom
|
|
40
|
+
hint: "strom config set main.person P0001 (the person the tree is for), or strom query --of P0001",
|
|
41
41
|
});
|
|
42
42
|
const p = tree.get(id);
|
|
43
43
|
if (!p || p.retracted)
|
|
44
|
-
throw new UsageError(`${id} is retracted: no facts are related to it`, { hint: "strom
|
|
44
|
+
throw new UsageError(`${id} is retracted: no facts are related to it`, { hint: "strom query --of P0001 (a person of the tree)" });
|
|
45
45
|
return p;
|
|
46
46
|
}
|
|
47
47
|
/** The tree's link to a person in the Strom app; none when the tree has no link. */
|
|
@@ -56,7 +56,7 @@ function openOf(ctx, tree) {
|
|
|
56
56
|
return (id) => (base ? personUrl(base, id) : undefined);
|
|
57
57
|
}
|
|
58
58
|
register({
|
|
59
|
-
path: ["
|
|
59
|
+
path: ["query"],
|
|
60
60
|
summary: "The facts of the tree as rows: who (and how related), what, where, when, how sure, on what source — counted and grouped",
|
|
61
61
|
group: "analysis",
|
|
62
62
|
tree: true,
|
|
@@ -68,8 +68,15 @@ register({
|
|
|
68
68
|
"found at the start of a word of the value, label or cause (not the note), with any accent or none, and with the\n" +
|
|
69
69
|
"forms of an occupation in Czech, German, Latin and Polish (mlynar finds Müller, molitor); --exact: the word itself.\n" +
|
|
70
70
|
"--kin: ancestors (the person and the direct line), blood (the default: the ancestors and all their descendants,\n" +
|
|
71
|
-
"the side branches too), family (blood and their partners), all (the whole tree). Answer with
|
|
72
|
-
"
|
|
71
|
+
"the side branches too), family (blood and their partners), all (the whole tree). Answer with each person's name and\n" +
|
|
72
|
+
"their ID in brackets after it, the relation in words whole as strom query gives it, never shortened, the source by\n" +
|
|
73
|
+
"its title with its S… in brackets; the Strom app opens a person: strom app --person P0001.\n" +
|
|
74
|
+
"--story <word>: the people (and couples) whose story holds the word (found as with --value), each with the sentence\n" +
|
|
75
|
+
"and the sources it rests on where they can be told (else the story's); the other filters choose the people (those\n" +
|
|
76
|
+
"with a fact answering them). A story retells the facts: answer from the facts and sources, a story only shows\n" +
|
|
77
|
+
"where to look.\n" +
|
|
78
|
+
"For answering the user and for finding where to look: whose a record is, who a person is, verifying and writing\n" +
|
|
79
|
+
"facts go as ever through strom person show, the sources and the method — a row of strom query is not enough for it.",
|
|
73
80
|
options: [
|
|
74
81
|
{ name: "kind", type: "string", multiple: true, value: "<tag>", description: "only facts of this kind: OCCU, RESI, BIRT, DEAT, MARR … (repeatable, or comma separated)" },
|
|
75
82
|
{ name: "occupation", type: "string", multiple: true, value: "<word>", description: "an occupation (OCCU) by a word, with its forms in other languages (repeatable: any)" },
|
|
@@ -81,17 +88,18 @@ register({
|
|
|
81
88
|
{ name: "surname", type: "string", value: "<surname>", description: "people of this surname (its other forms too: Lhotakova, the groups made one family)" },
|
|
82
89
|
{ name: "source", type: "string", value: "<S…|words>", description: "facts citing this source (its ID, or words of its title)" },
|
|
83
90
|
{ name: "status", type: "string", multiple: true, value: "<status>", description: `only facts this sure: ${ASKED_STATUSES.join(", ")} (repeatable); disproven only so` },
|
|
91
|
+
{ name: "story", type: "string", multiple: true, value: "<word>", description: "the stories holding this word, a row per story (repeatable: any of them)" },
|
|
84
92
|
{ name: "of", type: "string", value: "<P…>", description: "the person the relations are to (default: the main person, strom config get main.person)" },
|
|
85
93
|
{ name: "kin", type: "string", value: "<set>", description: `whose facts: ${KIN_SETS.join(", ")} (default blood)` },
|
|
86
94
|
{ name: "count", type: "boolean", description: "only the numbers (people, facts); with --by for each group" },
|
|
87
95
|
{ name: "by", type: "string", value: "<group>", description: `group by ${FACT_GROUPS.join(", ")} (with --count: numbers only)` },
|
|
88
96
|
],
|
|
89
97
|
examples: [
|
|
90
|
-
"strom
|
|
91
|
-
"strom
|
|
92
|
-
"strom
|
|
93
|
-
"strom
|
|
94
|
-
"strom
|
|
98
|
+
"strom query --occupation mlynar --count --by generation",
|
|
99
|
+
"strom query --occupation mlynar",
|
|
100
|
+
"strom query --place Lhota --house 12 --by kin",
|
|
101
|
+
"strom query --surname Lhotak --years 1700-1800 --kind BIRT --count --by decade",
|
|
102
|
+
"strom query --source S0001",
|
|
95
103
|
],
|
|
96
104
|
run(ctx, { opts }) {
|
|
97
105
|
const tree = ctx.tree();
|
|
@@ -101,23 +109,26 @@ register({
|
|
|
101
109
|
const of = ofPerson(tree, opts.of);
|
|
102
110
|
const kin = oneOf(opts.kin, KIN_SETS, "kin") ?? "blood";
|
|
103
111
|
const by = oneOf(opts.by, FACT_GROUPS, "by");
|
|
112
|
+
const storyWords = listOpt(opts.story).filter((x) => x.trim());
|
|
113
|
+
if (storyWords.length && (by === "place" || by === "decade"))
|
|
114
|
+
throw new UsageError(`--by ${by} groups facts: with --story, --by takes generation, kin, surname`, { hint: `strom query --story ${shellArg(storyWords[0])} --by generation` });
|
|
104
115
|
const occupations = listOpt(opts.occupation);
|
|
105
116
|
const values = [...occupations, ...listOpt(opts.value)];
|
|
106
117
|
let kinds = csvOpt(opts.kind);
|
|
107
118
|
const unknown = kinds.find((k) => !eventKind(k.trim()));
|
|
108
119
|
if (unknown !== undefined)
|
|
109
120
|
throw new UsageError(`unknown --kind "${unknown}": --kind takes ${Object.keys(EVENT_KINDS).join(", ")} (or the English name: occupation, residence …)`, {
|
|
110
|
-
hint: "strom
|
|
121
|
+
hint: "strom query --kind OCCU",
|
|
111
122
|
});
|
|
112
123
|
if (occupations.length) {
|
|
113
124
|
if (kinds.length && !kinds.some((k) => k.toUpperCase() === "OCCU" || k.toLowerCase() === "occupation"))
|
|
114
|
-
throw new UsageError("--occupation is a fact of the kind OCCU: no other --kind beside it", { hint: `strom
|
|
125
|
+
throw new UsageError("--occupation is a fact of the kind OCCU: no other --kind beside it", { hint: `strom query --kind ${kinds[0]} --value ${shellArg(occupations[0])}` });
|
|
115
126
|
kinds = ["OCCU"];
|
|
116
127
|
}
|
|
117
128
|
const statuses = listOpt(opts.status).flatMap((s) => s.split(",")).map((s) => oneOf(s, ASKED_STATUSES, "status"));
|
|
118
129
|
const years = opts.years === undefined ? undefined : parseYears(String(opts.years));
|
|
119
130
|
if (opts.years !== undefined && !years)
|
|
120
|
-
throw new UsageError(`--years takes 1750-1850 or one year, not "${opts.years}"`, { hint: "strom
|
|
131
|
+
throw new UsageError(`--years takes 1750-1850 or one year, not "${opts.years}"`, { hint: "strom query --years 1750-1850" });
|
|
121
132
|
const str = (v) => (typeof v === "string" && v.trim() ? v.trim() : undefined);
|
|
122
133
|
const q = {
|
|
123
134
|
of: of.id,
|
|
@@ -132,7 +143,9 @@ register({
|
|
|
132
143
|
...(str(opts.source) ? { source: str(opts.source) } : {}),
|
|
133
144
|
...(statuses.length ? { statuses } : {}),
|
|
134
145
|
};
|
|
135
|
-
|
|
146
|
+
// the stories holding a word (the other filters choose the people), else the facts
|
|
147
|
+
const st = storyWords.length ? findStories(tree, q, storyWords) : undefined;
|
|
148
|
+
const a = st ? undefined : findFacts(tree, q);
|
|
136
149
|
// the command again (the next page, a wider set): its options as typed, plain words
|
|
137
150
|
const typed = [];
|
|
138
151
|
for (const k of kinds.length && !occupations.length ? kinds : [])
|
|
@@ -148,64 +161,162 @@ register({
|
|
|
148
161
|
typed.push(`--${k}`, shellArg(str(opts[k])));
|
|
149
162
|
for (const s of statuses)
|
|
150
163
|
typed.push("--status", s);
|
|
164
|
+
for (const x of storyWords)
|
|
165
|
+
typed.push("--story", shellArg(x));
|
|
151
166
|
if (typeof opts.of === "string" && opts.of.trim())
|
|
152
167
|
typed.push("--of", of.id);
|
|
153
|
-
const command = (more) => ["strom
|
|
168
|
+
const command = (more) => ["strom query", ...typed, ...more].join(" ");
|
|
154
169
|
const kinArg = kin === "blood" ? [] : ["--kin", kin];
|
|
155
170
|
// the words: an agent's English, a person's language at a terminal; a relation always in the research's language
|
|
156
171
|
const say = (key, english, params = {}) => (w.lang ? ui(w.lang, key, params) : fillEn(english, params));
|
|
157
172
|
const ofText = `${of.id} ${personLabel(of)}`;
|
|
158
|
-
const kinText = say(`ui.
|
|
173
|
+
const kinText = say(`ui.query.kin.${kin}`, KIN_EN[kin], { of: ofText });
|
|
159
174
|
const what = [
|
|
175
|
+
...(st
|
|
176
|
+
? [say("ui.query.story", "story {words}", { words: `${storyWords.join(" | ")}${st.known && st.variants.length > 1 ? ` (= ${st.variants.join(", ")})` : ""}` })]
|
|
177
|
+
: []),
|
|
160
178
|
...(kinds.length || values.length
|
|
161
179
|
? [
|
|
162
180
|
[
|
|
163
181
|
kinds.map((k) => (w.lang ? eventName(factKind(k), w.lang) : factKind(k))).join("/"),
|
|
164
|
-
values.length ? `${values.join(" | ")}${a
|
|
182
|
+
values.length ? `${values.join(" | ")}${a?.known && a.variants.length > 1 ? ` (= ${a.variants.join(", ")})` : ""}` : "",
|
|
165
183
|
]
|
|
166
184
|
.filter(Boolean)
|
|
167
185
|
.join(" "),
|
|
168
186
|
]
|
|
169
187
|
: []),
|
|
170
|
-
...(q.place ? [say("ui.
|
|
171
|
-
...(q.house ? [w.lang && houseHasWord(q.house) ? q.house : say("ui.
|
|
188
|
+
...(q.place ? [say("ui.query.place", "place {place}", { place: q.place })] : []),
|
|
189
|
+
...(q.house ? [w.lang && houseHasWord(q.house) ? q.house : say("ui.query.house", "house {house}", { house: q.house })] : []),
|
|
172
190
|
...(q.years ? [q.years.from === q.years.to ? String(q.years.from) : `${q.years.from}-${q.years.to}`] : []),
|
|
173
|
-
...(q.surname ? [say("ui.
|
|
174
|
-
...(q.source ? [say("ui.
|
|
191
|
+
...(q.surname ? [say("ui.query.surname", "surname {surname}", { surname: q.surname })] : []),
|
|
192
|
+
...(q.source ? [say("ui.query.source", "source {source}", { source: q.source })] : []),
|
|
175
193
|
...(statuses.length ? [statuses.map((s) => (w.lang ? statusName(s, w.lang) : s)).join("/")] : []),
|
|
176
194
|
].join(" · ");
|
|
177
|
-
const countText = (people, facts) => w.lang ? ui(w.lang, "ui.
|
|
178
|
-
const
|
|
179
|
-
const selfTerm = ui(lang, "ui.facts.self");
|
|
195
|
+
const countText = (people, facts) => w.lang ? ui(w.lang, "ui.query.count", { people, facts }) : `${counted(people, "person", "people")}, ${counted(facts, "fact")}`;
|
|
196
|
+
const selfTerm = ui(lang, "ui.query.self");
|
|
180
197
|
const term = (r) => (r.self ? selfTerm : r.relation ? relationText(r.relation, lang) : undefined);
|
|
181
198
|
const generation = (r) => r.line ?? r.relation?.generation;
|
|
182
199
|
const open = openOf(ctx, tree);
|
|
183
200
|
const groupLabel = (key, labels) => {
|
|
184
201
|
if (key === "unknown")
|
|
185
|
-
return say("ui.
|
|
202
|
+
return say("ui.query.unknown", "unknown");
|
|
186
203
|
if (by === "generation")
|
|
187
|
-
return key === "side" ? say("ui.
|
|
204
|
+
return key === "side" ? say("ui.query.side", "side branches") : key;
|
|
188
205
|
if (by === "decade")
|
|
189
206
|
return `${key.slice(0, -1)}–${Number(key.slice(0, -1)) + 9}`;
|
|
190
207
|
return labels.get(key) ?? key;
|
|
191
208
|
};
|
|
209
|
+
const relationData = (r) => {
|
|
210
|
+
const g = generation(r);
|
|
211
|
+
return r.self
|
|
212
|
+
? { term: selfTerm, termEn: "self", generation: 1, path: [r.person.id] }
|
|
213
|
+
: r.relation
|
|
214
|
+
? { term: r.relation.term[tl], termEn: r.relation.term.en, ...(r.relation.side ? { side: r.relation.side } : {}), ...(g !== undefined ? { generation: g } : {}), path: r.relation.path }
|
|
215
|
+
: null;
|
|
216
|
+
};
|
|
217
|
+
const whoText = (r) => {
|
|
218
|
+
const g = generation(r);
|
|
219
|
+
return [`${r.person.id} ${personLabel(r.person)}`, `${term(r) ?? say("ui.query.unrelated", "not related")}${g !== undefined ? ` (G${g})` : ""}`];
|
|
220
|
+
};
|
|
221
|
+
const sourcesText = (list) => {
|
|
222
|
+
const shown = list.slice(0, 2).map((s) => `${s.id}${s.title ? ` ${truncate(s.title, 40)}` : ""}`);
|
|
223
|
+
return shown.length ? `${shown.join(", ")}${list.length > 2 ? ` +${list.length - 2}` : ""}` : "";
|
|
224
|
+
};
|
|
225
|
+
const pageOf = (rows, grouped, groups, text, count) => {
|
|
226
|
+
const ordered = grouped ? grouped.groups.flatMap((g) => g.rows) : rows;
|
|
227
|
+
const page = paginate(ordered, Math.min(ctx.limit, LIST_PAGE_MAX), ctx.page);
|
|
228
|
+
const body = [];
|
|
229
|
+
if (grouped) {
|
|
230
|
+
const keyOf = new Map();
|
|
231
|
+
for (const g of grouped.groups)
|
|
232
|
+
for (const r of g.rows)
|
|
233
|
+
keyOf.set(r, g.key);
|
|
234
|
+
let at;
|
|
235
|
+
for (const r of page.items) {
|
|
236
|
+
const k = keyOf.get(r);
|
|
237
|
+
if (k !== at) {
|
|
238
|
+
const g = groups.find((x) => x.key === k);
|
|
239
|
+
body.push(`${g.label}: ${count(g.people, g.facts)}`);
|
|
240
|
+
at = k;
|
|
241
|
+
}
|
|
242
|
+
body.push(` ${text(r)}`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else
|
|
246
|
+
body.push(...page.items.map(text));
|
|
247
|
+
return { page, body };
|
|
248
|
+
};
|
|
249
|
+
const tries = (word) => [...(word ? [`strom find ${shellArg(word)}`] : []), ...(WIDER[kin] ? [command(["--kin", WIDER[kin]])] : [])];
|
|
250
|
+
const elsewhereOf = (ids, word) => ids.length
|
|
251
|
+
? say("ui.query.elsewhere", "+{n} with the word only elsewhere (a name, a note, …): {command}", {
|
|
252
|
+
n: w.lang ? ids.length : counted(ids.length, "person", "people"),
|
|
253
|
+
command: `strom find ${shellArg(word)}`,
|
|
254
|
+
})
|
|
255
|
+
: undefined;
|
|
256
|
+
if (st) {
|
|
257
|
+
const countStories = (people, stories) => w.lang ? ui(w.lang, "ui.query.count.stories", { people, stories }) : `${counted(people, "person", "people")}, ${counted(stories, "story", "stories")}`;
|
|
258
|
+
const storyText = (r) => [
|
|
259
|
+
...whoText(r),
|
|
260
|
+
`${r.owner.type === "family" ? `${r.owner.id} ` : ""}${say("ui.query.story.snippet", "story: “{text}”", { text: r.snippet })}`,
|
|
261
|
+
r.draft ? say("ui.query.story.draft", "draft") : "",
|
|
262
|
+
r.sources.length ? (r.basis === "story" ? say("ui.query.story.all", "the story's sources: {list}", { list: sourcesText(r.sources) }) : sourcesText(r.sources)) : "",
|
|
263
|
+
]
|
|
264
|
+
.filter(Boolean)
|
|
265
|
+
.join(" · ");
|
|
266
|
+
const storyData = (r) => {
|
|
267
|
+
const url = open(r.person.id);
|
|
268
|
+
return {
|
|
269
|
+
person: { id: r.person.id, name: displayName(r.person), lifespan: lifespan(r.person) },
|
|
270
|
+
relation: relationData(r),
|
|
271
|
+
story: { of: r.owner.id, draft: r.draft, snippet: r.snippet, sources: r.sources, basis: r.basis },
|
|
272
|
+
...(url ? { open: url } : {}),
|
|
273
|
+
};
|
|
274
|
+
};
|
|
275
|
+
const word = storyWords[0];
|
|
276
|
+
const elsewhere = elsewhereOf(st.elsewhere, word);
|
|
277
|
+
const data = {
|
|
278
|
+
of: { id: of.id, name: personLabel(of) },
|
|
279
|
+
kin,
|
|
280
|
+
variants: st.variants,
|
|
281
|
+
total: { people: st.people, stories: st.rows.length },
|
|
282
|
+
elsewhere: { people: st.elsewhere.length, ...(st.elsewhere.length ? { ids: st.elsewhere, command: `strom find ${shellArg(word)}` } : {}) },
|
|
283
|
+
};
|
|
284
|
+
if (!st.rows.length) {
|
|
285
|
+
const t = tries(word);
|
|
286
|
+
return {
|
|
287
|
+
text: lines(say("ui.query.none", "nothing found: {query}", { query: `${what ? `${what} · ` : ""}${kinText}` }), elsewhere, t.length ? say("ui.query.try", "try: {commands}", { commands: t.join(" · ") }) : undefined),
|
|
288
|
+
data: { ...data, rows: [] },
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
const head = `${what ? `${what} · ` : ""}${kinText}: ${countStories(st.people, st.rows.length)}`;
|
|
292
|
+
const grouped = by ? groupRows(st.rows, by, term) : undefined;
|
|
293
|
+
const groups = grouped?.groups.map((g) => ({ key: g.key, label: groupLabel(g.key, grouped.labels), people: g.people, facts: g.facts }));
|
|
294
|
+
const groupsData = groups?.map(({ facts, ...g }) => ({ ...g, stories: facts }));
|
|
295
|
+
if (opts.count)
|
|
296
|
+
return {
|
|
297
|
+
text: lines(head, ...(groups ?? []).map((g) => ` ${g.label}: ${countStories(g.people, g.facts)}`), elsewhere),
|
|
298
|
+
data: { ...data, ...(groupsData ? { groups: groupsData } : {}) },
|
|
299
|
+
};
|
|
300
|
+
const { page, body } = pageOf(st.rows, grouped, groups, storyText, countStories);
|
|
301
|
+
return {
|
|
302
|
+
text: lines(head, ...body, elsewhere, moreLine(page, command(kinArg.concat(by ? ["--by", by] : [])), w.lang)),
|
|
303
|
+
data: { ...data, ...(groupsData ? { groups: groupsData } : {}), page: page.page, pages: page.pages, rows: page.items.map(storyData) },
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
const fa = a;
|
|
307
|
+
const head = `${what ? `${what} · ` : ""}${kinText}: ${countText(fa.people, fa.rows.length)}`;
|
|
192
308
|
const rowText = (r) => {
|
|
193
309
|
const e = r.fact;
|
|
194
|
-
const g = generation(r);
|
|
195
|
-
const rel = term(r) ?? say("ui.facts.unrelated", "not related");
|
|
196
310
|
const kind = w.lang ? eventName(e.kind, w.lang, e.label) : `${e.kind}${e.label ? ` ${e.label}` : ""}`;
|
|
197
311
|
const value = [e.value, e.cause].filter(Boolean).join(", ");
|
|
198
312
|
const where = w.lang ? humanPlace(e.place, e.house, w.lang) : [e.place, e.house ? `house ${e.house}` : ""].filter(Boolean).join(", ");
|
|
199
|
-
const shown = r.sources.slice(0, 2).map((s) => `${s.id}${s.title ? ` ${truncate(s.title, 40)}` : ""}`);
|
|
200
|
-
const more = r.sources.length > 2 ? ` +${r.sources.length - 2}` : "";
|
|
201
313
|
return [
|
|
202
|
-
|
|
203
|
-
`${rel}${g !== undefined ? ` (G${g})` : ""}`,
|
|
314
|
+
...whoText(r),
|
|
204
315
|
`${e.id}${r.owner.type === "family" ? ` ${r.owner.id}` : ""} ${kind}${value ? ` ${value}` : ""}`,
|
|
205
316
|
where,
|
|
206
317
|
w.lang ? humanDate(e.date, w.lang) : (e.date ?? ""),
|
|
207
318
|
w.lang ? statusName(e.status, w.lang) : e.status,
|
|
208
|
-
|
|
319
|
+
sourcesText(r.sources),
|
|
209
320
|
]
|
|
210
321
|
.filter(Boolean)
|
|
211
322
|
.join(" · ");
|
|
@@ -213,14 +324,9 @@ register({
|
|
|
213
324
|
const rowData = (r) => {
|
|
214
325
|
const e = r.fact;
|
|
215
326
|
const url = open(r.person.id);
|
|
216
|
-
const g = generation(r);
|
|
217
327
|
return {
|
|
218
328
|
person: { id: r.person.id, name: displayName(r.person), lifespan: lifespan(r.person) },
|
|
219
|
-
relation: r
|
|
220
|
-
? { term: selfTerm, termEn: "self", generation: 1, path: [r.person.id] }
|
|
221
|
-
: r.relation
|
|
222
|
-
? { term: r.relation.term[tl], termEn: r.relation.term.en, ...(r.relation.side ? { side: r.relation.side } : {}), ...(g !== undefined ? { generation: g } : {}), path: r.relation.path }
|
|
223
|
-
: null,
|
|
329
|
+
relation: relationData(r),
|
|
224
330
|
fact: {
|
|
225
331
|
id: e.id,
|
|
226
332
|
...(r.owner.type === "family" ? { family: r.owner.id } : {}),
|
|
@@ -238,30 +344,22 @@ register({
|
|
|
238
344
|
};
|
|
239
345
|
};
|
|
240
346
|
const findWord = values[0];
|
|
241
|
-
const elsewhere =
|
|
242
|
-
? say("ui.facts.elsewhere", "+{n} with the word only elsewhere (a name, a note, …): {command}", {
|
|
243
|
-
n: w.lang ? a.elsewhere.length : counted(a.elsewhere.length, "person", "people"),
|
|
244
|
-
command: `strom find ${shellArg(findWord)}`,
|
|
245
|
-
})
|
|
246
|
-
: undefined;
|
|
347
|
+
const elsewhere = elsewhereOf(fa.elsewhere, findWord);
|
|
247
348
|
const data = {
|
|
248
349
|
of: { id: of.id, name: personLabel(of) },
|
|
249
350
|
kin,
|
|
250
|
-
variants:
|
|
251
|
-
total: { people:
|
|
252
|
-
elsewhere: { people:
|
|
351
|
+
variants: fa.variants,
|
|
352
|
+
total: { people: fa.people, facts: fa.rows.length },
|
|
353
|
+
elsewhere: { people: fa.elsewhere.length, ...(fa.elsewhere.length ? { ids: fa.elsewhere, command: `strom find ${shellArg(findWord)}` } : {}) },
|
|
253
354
|
};
|
|
254
|
-
if (!
|
|
255
|
-
const
|
|
256
|
-
...(findWord ? [`strom find ${shellArg(findWord)}`] : []),
|
|
257
|
-
...(WIDER[kin] ? [command(["--kin", WIDER[kin]])] : []),
|
|
258
|
-
];
|
|
355
|
+
if (!fa.rows.length) {
|
|
356
|
+
const t = tries(findWord);
|
|
259
357
|
return {
|
|
260
|
-
text: lines(say("ui.
|
|
358
|
+
text: lines(say("ui.query.none", "nothing found: {query}", { query: `${what ? `${what} · ` : ""}${kinText}` }), elsewhere, t.length ? say("ui.query.try", "try: {commands}", { commands: t.join(" · ") }) : undefined),
|
|
261
359
|
data: { ...data, rows: [] },
|
|
262
360
|
};
|
|
263
361
|
}
|
|
264
|
-
const grouped = by ? groupRows(
|
|
362
|
+
const grouped = by ? groupRows(fa.rows, by, term) : undefined;
|
|
265
363
|
const groups = grouped?.groups.map((g) => ({ key: g.key, label: groupLabel(g.key, grouped.labels), people: g.people, facts: g.facts }));
|
|
266
364
|
if (opts.count) {
|
|
267
365
|
return {
|
|
@@ -270,27 +368,7 @@ register({
|
|
|
270
368
|
};
|
|
271
369
|
}
|
|
272
370
|
// the rows (by group: in the order of the groups), a page at a time
|
|
273
|
-
const
|
|
274
|
-
const page = paginate(ordered, Math.min(ctx.limit, LIST_PAGE_MAX), ctx.page);
|
|
275
|
-
const body = [];
|
|
276
|
-
if (grouped) {
|
|
277
|
-
const keyOf = new Map();
|
|
278
|
-
for (const g of grouped.groups)
|
|
279
|
-
for (const r of g.rows)
|
|
280
|
-
keyOf.set(r, g.key);
|
|
281
|
-
let at;
|
|
282
|
-
for (const r of page.items) {
|
|
283
|
-
const k = keyOf.get(r);
|
|
284
|
-
if (k !== at) {
|
|
285
|
-
const g = groups.find((x) => x.key === k);
|
|
286
|
-
body.push(`${g.label}: ${countText(g.people, g.facts)}`);
|
|
287
|
-
at = k;
|
|
288
|
-
}
|
|
289
|
-
body.push(` ${rowText(r)}`);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
else
|
|
293
|
-
body.push(...page.items.map(rowText));
|
|
371
|
+
const { page, body } = pageOf(fa.rows, grouped, groups, rowText, countText);
|
|
294
372
|
return {
|
|
295
373
|
text: lines(head, ...body, elsewhere, moreLine(page, command(kinArg.concat(by ? ["--by", by] : [])), w.lang)),
|
|
296
374
|
data: { ...data, ...(groups ? { groups } : {}), page: page.page, pages: page.pages, rows: page.items.map(rowData) },
|
package/dist/commands/start.js
CHANGED
|
@@ -313,7 +313,7 @@ register({
|
|
|
313
313
|
function appPerson(tree, ref) {
|
|
314
314
|
const p = resolvePerson(tree, ref);
|
|
315
315
|
if (p.retracted)
|
|
316
|
-
throw new UsageError(`${p.id} is retracted: the app shows no such person`, { hint: "strom
|
|
316
|
+
throw new UsageError(`${p.id} is retracted: the app shows no such person`, { hint: "strom query or strom person list: the people of the tree" });
|
|
317
317
|
return p;
|
|
318
318
|
}
|
|
319
319
|
register({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The facts of the tree as rows (strom
|
|
1
|
+
// The facts of the tree as rows (strom query): one row is one fact of a person — or of a family (a marriage), then a
|
|
2
2
|
// row for each partner among the people asked about — with whom it is of, how that person is related to the person
|
|
3
3
|
// the question is about (the main person, or --of), what it says, where, when, how sure and on what sources. Read only.
|
|
4
4
|
//
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
// all their descendants: the side branches too), the family (the blood relatives and their partners), or all. The
|
|
12
12
|
// sets come from the families' links; how each person is related (core/relation.ts) is worked out only for the rows
|
|
13
13
|
// found, from one view of the person's family (relationsFrom) — no walk over the tree for each row.
|
|
14
|
+
//
|
|
15
|
+
// The stories (--story): a row per story of a person or of a couple (for each partner among the people asked about)
|
|
16
|
+
// whose text holds a word asked for, the same way as a fact's value; with the sentence it is in and the sources that
|
|
17
|
+
// sentence rests on where they can be told (the sources it names, the facts of the story of the years it names), else
|
|
18
|
+
// the sources of the whole story. A story retells the facts: it shows where to look, never what is proven.
|
|
14
19
|
import { STATUSES, eventKind } from "./model.js";
|
|
15
20
|
import { ancestorGenerations, displayName, familiesAsPartner, lifespan, primaryName } from "./people.js";
|
|
16
21
|
import { familyForms, isWomansForm, surnameFormOf } from "./surnames.js";
|
|
@@ -22,6 +27,7 @@ import { dateYears } from "./gdate.js";
|
|
|
22
27
|
import { foldText, tokens } from "./text.js";
|
|
23
28
|
import { houseKey } from "./house.js";
|
|
24
29
|
import { searchText } from "./searchtext.js";
|
|
30
|
+
import { sourcesNamed, storySources } from "./storykeep.js";
|
|
25
31
|
export const KIN_SETS = ["ancestors", "blood", "family", "all"];
|
|
26
32
|
export const FACT_GROUPS = ["generation", "kin", "place", "decade", "surname"];
|
|
27
33
|
/** The statuses a fact is shown with unless --status says which: all but disproven (and retracted, never). */
|
|
@@ -174,6 +180,129 @@ export function findFacts(tree, q) {
|
|
|
174
180
|
const variants = [...new Set(matchers.flatMap((m) => m.variants))];
|
|
175
181
|
return { of, kin: q.kin, variants, known: matchers.some((m) => m.known), rows, people: new Set(rows.map((r) => r.person.id)).size, elsewhere };
|
|
176
182
|
}
|
|
183
|
+
// ── stories ─────────────────────────────────────────────────────────────────
|
|
184
|
+
/** The fact filters of a query: any of them chooses the people of a story query (those with a fact answering them). */
|
|
185
|
+
export function asksFacts(q) {
|
|
186
|
+
return !!(q.kinds?.length || q.values?.length || q.place || q.house || q.years || q.source || q.statuses?.length);
|
|
187
|
+
}
|
|
188
|
+
const SNIPPET = 160;
|
|
189
|
+
/** A story's text as sentences: its paragraphs and sentences, without the marks the app shows (## , - , **). */
|
|
190
|
+
function sentences(text) {
|
|
191
|
+
return text
|
|
192
|
+
.normalize("NFC")
|
|
193
|
+
.split(/\n\s*\n/u)
|
|
194
|
+
.flatMap((para) => para
|
|
195
|
+
.split("\n")
|
|
196
|
+
.map((l) => l.replace(/^\s*(?:#{1,6}\s+|[-*]\s+)/u, ""))
|
|
197
|
+
.join(" ")
|
|
198
|
+
.replace(/\*\*|(?<![\p{L}\p{N}])\*|\*(?![\p{L}\p{N}])/gu, "")
|
|
199
|
+
.split(/(?<=[.!?…])\s+(?=[\p{Lu}\p{N}„"“«‚(])/u))
|
|
200
|
+
.map((x) => x.replace(/\s+/gu, " ").trim())
|
|
201
|
+
.filter(Boolean);
|
|
202
|
+
}
|
|
203
|
+
/** The sentence cut around the word that matched (the whole sentence when short). */
|
|
204
|
+
function snippetOf(sentence, m) {
|
|
205
|
+
if (sentence.length <= SNIPPET)
|
|
206
|
+
return sentence;
|
|
207
|
+
// where the word starts: the last word from which on the text still matches
|
|
208
|
+
let at = 0;
|
|
209
|
+
for (const w of sentence.matchAll(/[\p{L}\p{M}\p{N}]+/gu)) {
|
|
210
|
+
if (!m.matches(sentence.slice(w.index)))
|
|
211
|
+
break;
|
|
212
|
+
at = w.index;
|
|
213
|
+
}
|
|
214
|
+
const from = Math.max(0, at - 60);
|
|
215
|
+
const start = from === 0 ? 0 : sentence.indexOf(" ", from) + 1 || from;
|
|
216
|
+
let end = Math.min(sentence.length, start + SNIPPET);
|
|
217
|
+
if (end < sentence.length)
|
|
218
|
+
end = sentence.lastIndexOf(" ", end) > at ? sentence.lastIndexOf(" ", end) : end;
|
|
219
|
+
return `${start > 0 ? "…" : ""}${sentence.slice(start, end).trim()}${end < sentence.length ? "…" : ""}`;
|
|
220
|
+
}
|
|
221
|
+
/** The stories of the people asked about that hold a word asked for, with the sentence and what it rests on. */
|
|
222
|
+
export function findStories(tree, q, words) {
|
|
223
|
+
const of = tree.get(q.of);
|
|
224
|
+
if (!live(of))
|
|
225
|
+
throw new Error(`no person ${q.of}`);
|
|
226
|
+
const { people: set, line } = kinSet(tree, of.id, q.kin);
|
|
227
|
+
const surname = q.surname ? familyForms(tree, q.surname) : undefined;
|
|
228
|
+
const surnameOf = (p) => !surname || p.names.some((n) => [...surnameForms(surnameFormOf(n.surname ?? ""))].some((f) => surname.has(f)));
|
|
229
|
+
// the fact filters choose the people: those with a fact answering them
|
|
230
|
+
const withFacts = asksFacts(q) ? new Set(findFacts(tree, q).rows.map((r) => r.person.id)) : undefined;
|
|
231
|
+
const people = [...set].filter((id) => surnameOf(tree.get(id)) && (!withFacts || withFacts.has(id)));
|
|
232
|
+
const matchers = words.map((v) => occupationMatcher(v, { exact: !!q.exact })).filter((m) => m.word);
|
|
233
|
+
const sources = new Map(tree.list("source").map((s) => [s.id, s]));
|
|
234
|
+
const events = new Map();
|
|
235
|
+
for (const t of ["person", "family"])
|
|
236
|
+
for (const r of tree.list(t))
|
|
237
|
+
for (const e of r.events)
|
|
238
|
+
events.set(e.id, e);
|
|
239
|
+
const titled = (ids) => ids.map((id) => ({ id, title: sources.get(id)?.title ?? "" }));
|
|
240
|
+
/** The first sentence of the story (the approved one, then a new version waiting) holding a word, and what it rests on. */
|
|
241
|
+
const inStory = (st) => {
|
|
242
|
+
if (!st)
|
|
243
|
+
return undefined;
|
|
244
|
+
for (const v of [st, ...(st.draft ? [st.draft] : [])]) {
|
|
245
|
+
for (const sentence of sentences([v.title, v.text].filter(Boolean).join("\n\n"))) {
|
|
246
|
+
const m = matchers.find((x) => x.matches(sentence));
|
|
247
|
+
if (!m)
|
|
248
|
+
continue;
|
|
249
|
+
const draft = v !== st || st.status !== "final";
|
|
250
|
+
// the sources the sentence names; else those cited by the story's facts of a year the sentence names
|
|
251
|
+
let ids = sourcesNamed(tree, sentence);
|
|
252
|
+
if (!ids.length) {
|
|
253
|
+
const years = new Set((sentence.match(/(?<![\p{L}\p{N}])\d{3,4}(?![\p{L}\p{N}])/gu) ?? []).map(Number));
|
|
254
|
+
const facts = v.facts.map((f) => events.get(f)).filter((e) => !!e && !e.retracted && dateYears(e.date ?? "").some((y) => years.has(y)));
|
|
255
|
+
ids = [...new Set(facts.flatMap((e) => e.citations.map((c) => c.source)))].filter((id) => sources.has(id) && !sources.get(id).retracted);
|
|
256
|
+
}
|
|
257
|
+
if (ids.length)
|
|
258
|
+
return { snippet: snippetOf(sentence, m), draft, sources: titled(ids), basis: "sentence" };
|
|
259
|
+
return { snippet: snippetOf(sentence, m), draft, sources: storySources(tree, v, events).map((x) => ({ id: x.id, title: x.title })), basis: "story" };
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return undefined;
|
|
263
|
+
};
|
|
264
|
+
const found = [];
|
|
265
|
+
const told = new Set();
|
|
266
|
+
const familyStory = new Map();
|
|
267
|
+
for (const id of people) {
|
|
268
|
+
const p = tree.get(id);
|
|
269
|
+
const where = { person: p, self: id === of.id, ...(line.has(id) ? { line: line.get(id) } : {}) };
|
|
270
|
+
const own = inStory(p.story);
|
|
271
|
+
if (own)
|
|
272
|
+
found.push({ ...where, owner: p, ...own });
|
|
273
|
+
for (const f of familiesAsPartner(tree, id)) {
|
|
274
|
+
if (f.retracted)
|
|
275
|
+
continue;
|
|
276
|
+
if (!familyStory.has(f.id))
|
|
277
|
+
familyStory.set(f.id, inStory(f.story));
|
|
278
|
+
const hit = familyStory.get(f.id);
|
|
279
|
+
if (hit)
|
|
280
|
+
found.push({ ...where, owner: f, ...hit });
|
|
281
|
+
}
|
|
282
|
+
if (own || found.some((r) => r.person.id === id))
|
|
283
|
+
told.add(id);
|
|
284
|
+
}
|
|
285
|
+
const relationOf = relationsFrom(tree, of.id);
|
|
286
|
+
const relations = new Map();
|
|
287
|
+
const rows = found.map((r) => {
|
|
288
|
+
if (!relations.has(r.person.id))
|
|
289
|
+
relations.set(r.person.id, r.self ? undefined : relationOf(r.person.id));
|
|
290
|
+
const relation = relations.get(r.person.id);
|
|
291
|
+
return { ...r, ...(relation ? { relation } : {}) };
|
|
292
|
+
});
|
|
293
|
+
rows.sort(byRow);
|
|
294
|
+
// the people with a word only elsewhere in their record (a note, a name): strom find
|
|
295
|
+
const folded = matchers.map((m) => foldText(m.word)).filter(Boolean);
|
|
296
|
+
const elsewhere = people.filter((id) => {
|
|
297
|
+
if (told.has(id))
|
|
298
|
+
return false;
|
|
299
|
+
const p = tree.get(id);
|
|
300
|
+
const hay = foldText(searchText({ ...p, story: undefined, events: p.events.filter((e) => !e.retracted && e.status !== "retracted") }));
|
|
301
|
+
return folded.some((w) => hay.includes(w));
|
|
302
|
+
});
|
|
303
|
+
const variants = [...new Set(matchers.flatMap((m) => m.variants))];
|
|
304
|
+
return { of, kin: q.kin, variants, known: matchers.some((m) => m.known), rows, people: new Set(rows.map((r) => r.person.id)).size, elsewhere };
|
|
305
|
+
}
|
|
177
306
|
/** The line first by generation (the person, the parents, …), then the others by generation, each person's facts by date. */
|
|
178
307
|
function byRow(a, b) {
|
|
179
308
|
const ga = a.line ?? a.relation?.generation ?? -Infinity;
|
|
@@ -186,8 +315,8 @@ function byRow(a, b) {
|
|
|
186
315
|
return la === 0 ? ga - gb : gb - ga;
|
|
187
316
|
if (a.person.id !== b.person.id)
|
|
188
317
|
return a.person.id < b.person.id ? -1 : 1;
|
|
189
|
-
const ya = dateYears(a.fact
|
|
190
|
-
const yb = dateYears(b.fact
|
|
318
|
+
const ya = dateYears(a.fact?.date ?? "")[0] ?? Infinity;
|
|
319
|
+
const yb = dateYears(b.fact?.date ?? "")[0] ?? Infinity;
|
|
191
320
|
return ya - yb;
|
|
192
321
|
}
|
|
193
322
|
export function termLang(lang) {
|
|
@@ -211,9 +340,9 @@ export function groupKey(r, by, term) {
|
|
|
211
340
|
case "kin":
|
|
212
341
|
return term(r) ?? "unknown";
|
|
213
342
|
case "place":
|
|
214
|
-
return r.fact
|
|
343
|
+
return r.fact?.place?.normalize("NFC").trim() || "unknown";
|
|
215
344
|
case "decade": {
|
|
216
|
-
const y = dateYears(r.fact
|
|
345
|
+
const y = dateYears(r.fact?.date ?? "")[0];
|
|
217
346
|
return y === undefined ? "unknown" : `${Math.floor(y / 10) * 10}s`;
|
|
218
347
|
}
|
|
219
348
|
case "surname": {
|
package/dist/core/searchtext.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The text of a record a full-text search reads (strom find; strom
|
|
1
|
+
// The text of a record a full-text search reads (strom find; strom query counts the people who have a word only there).
|
|
2
2
|
/** What was taken back or replaced (spec 016): kept for the history, never searched — at any depth of a record. */
|
|
3
3
|
const NOT_SEARCHED = new Set(["retractedNames", "retractedNotes", "edits", "noteEdits"]);
|
|
4
4
|
/** Searchable text of a record: every string of it, its parts apart (\u0001). */
|
package/dist/core/tree.js
CHANGED
|
@@ -32,7 +32,7 @@ export const TREE_FILE = "strom.json";
|
|
|
32
32
|
export const SEAL_FOREIGN = "seal.foreign";
|
|
33
33
|
// between releases the candidate being made (a bridge run from the sources says what it is: the Strom app goes by it);
|
|
34
34
|
// at a release the release's own (package.json)
|
|
35
|
-
export const VERSION = "1.32.0-beta.
|
|
35
|
+
export const VERSION = "1.32.0-beta.2";
|
|
36
36
|
/** What a new research is settled with from the start: nothing an older strom counted otherwise to set right in it. */
|
|
37
37
|
export const NEW_TREE_SETTLED = ["readers-1", "proven-originals-1", "origins-1", "verify-originals-1", "origins-tree-1"];
|
|
38
38
|
const GITIGNORE = `# Strom Research — local state and large files are not versioned
|