@kinloom/cli 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/assets/cached-ocr.py +556 -0
  2. package/dist/assets/ocr.md +52 -0
  3. package/dist/assets/prep-scan.md +59 -0
  4. package/dist/assets/prep-scan.py +891 -0
  5. package/dist/bundled-skills/acpl-persi/SKILL.md +94 -0
  6. package/dist/bundled-skills/acpl-persi/scripts/persi +268 -0
  7. package/dist/bundled-skills/archive-org/SKILL.md +129 -0
  8. package/dist/bundled-skills/archive-org/scripts/archive-org +879 -0
  9. package/dist/bundled-skills/blm-glo/SKILL.md +54 -0
  10. package/dist/bundled-skills/california-archives/SKILL.md +120 -0
  11. package/dist/bundled-skills/california-archives/scripts/ca-archives +373 -0
  12. package/dist/bundled-skills/chronicling-america/SKILL.md +100 -0
  13. package/dist/bundled-skills/chronicling-america/scripts/chronam +250 -0
  14. package/dist/bundled-skills/cyndis-list/SKILL.md +53 -0
  15. package/dist/bundled-skills/findagrave/SKILL.md +116 -0
  16. package/dist/bundled-skills/findagrave/scripts/findagrave +520 -0
  17. package/dist/bundled-skills/hathitrust/SKILL.md +110 -0
  18. package/dist/bundled-skills/hathitrust/scripts/hathi +194 -0
  19. package/dist/bundled-skills/kentucky-archives/SKILL.md +123 -0
  20. package/dist/bundled-skills/kentucky-archives/scripts/ky-archives +358 -0
  21. package/dist/bundled-skills/library-of-michigan/SKILL.md +111 -0
  22. package/dist/bundled-skills/library-of-michigan/scripts/michiganology +346 -0
  23. package/dist/bundled-skills/missouri-archives/SKILL.md +100 -0
  24. package/dist/bundled-skills/missouri-archives/scripts/mo-archives +528 -0
  25. package/dist/bundled-skills/nara-catalog-search/SKILL.md +118 -0
  26. package/dist/bundled-skills/nara-catalog-search/scripts/nara +934 -0
  27. package/dist/bundled-skills/narrative-audio/SKILL.md +103 -0
  28. package/dist/bundled-skills/narrative-audio/references/script-rules.md +109 -0
  29. package/dist/bundled-skills/narrative-audio/scripts/narrative-audio +290 -0
  30. package/dist/bundled-skills/new-jersey-archives/SKILL.md +118 -0
  31. package/dist/bundled-skills/new-jersey-archives/scripts/nj-archives +585 -0
  32. package/dist/bundled-skills/openarchieven/SKILL.md +90 -0
  33. package/dist/bundled-skills/openarchieven/scripts/openarchieven +432 -0
  34. package/dist/bundled-skills/texas-archives/SKILL.md +93 -0
  35. package/dist/bundled-skills/texas-archives/scripts/texas-archives +441 -0
  36. package/dist/bundled-skills/uk-archives/SKILL.md +101 -0
  37. package/dist/bundled-skills/uk-archives/scripts/uk-archives +391 -0
  38. package/dist/bundled-skills/usgs-gnis/SKILL.md +89 -0
  39. package/dist/bundled-skills/usgs-gnis/scripts/gnis +254 -0
  40. package/dist/bundled-skills/virginia-archives/SKILL.md +104 -0
  41. package/dist/bundled-skills/virginia-archives/scripts/va-archives +466 -0
  42. package/dist/bundled-skills/wikitree/SKILL.md +148 -0
  43. package/dist/bundled-skills/wikitree/scripts/wikitree +219 -0
  44. package/dist/cli.d.ts +1 -1
  45. package/dist/cli.d.ts.map +1 -1
  46. package/dist/cli.js +383 -26
  47. package/dist/cli.js.map +1 -1
  48. package/dist/client.js +1 -1
  49. package/dist/commands/init.js +3 -3
  50. package/dist/commands/ops/audit.d.ts +138 -0
  51. package/dist/commands/ops/audit.d.ts.map +1 -0
  52. package/dist/commands/ops/audit.js +867 -0
  53. package/dist/commands/ops/audit.js.map +1 -0
  54. package/dist/commands/ops/context.d.ts +100 -0
  55. package/dist/commands/ops/context.d.ts.map +1 -0
  56. package/dist/commands/ops/context.js +917 -0
  57. package/dist/commands/ops/context.js.map +1 -0
  58. package/dist/commands/ops/help.d.ts +6 -0
  59. package/dist/commands/ops/help.d.ts.map +1 -0
  60. package/dist/commands/ops/help.js +74 -0
  61. package/dist/commands/ops/help.js.map +1 -0
  62. package/dist/commands/ops/index.d.ts +6 -0
  63. package/dist/commands/ops/index.d.ts.map +1 -0
  64. package/dist/commands/ops/index.js +6 -0
  65. package/dist/commands/ops/index.js.map +1 -0
  66. package/dist/commands/ops/integrate.d.ts +56 -0
  67. package/dist/commands/ops/integrate.d.ts.map +1 -0
  68. package/dist/commands/ops/integrate.js +872 -0
  69. package/dist/commands/ops/integrate.js.map +1 -0
  70. package/dist/commands/ops/sync.d.ts +177 -0
  71. package/dist/commands/ops/sync.d.ts.map +1 -0
  72. package/dist/commands/ops/sync.js +1078 -0
  73. package/dist/commands/ops/sync.js.map +1 -0
  74. package/dist/commands/ops/telemetry.d.ts +79 -0
  75. package/dist/commands/ops/telemetry.d.ts.map +1 -0
  76. package/dist/commands/ops/telemetry.js +249 -0
  77. package/dist/commands/ops/telemetry.js.map +1 -0
  78. package/dist/commands/records/help.d.ts +18 -0
  79. package/dist/commands/records/help.d.ts.map +1 -0
  80. package/dist/commands/records/help.js +174 -0
  81. package/dist/commands/records/help.js.map +1 -0
  82. package/dist/commands/records/index.d.ts +5 -0
  83. package/dist/commands/records/index.d.ts.map +1 -0
  84. package/dist/commands/records/index.js +5 -0
  85. package/dist/commands/records/index.js.map +1 -0
  86. package/dist/commands/records/registry.d.ts +32 -0
  87. package/dist/commands/records/registry.d.ts.map +1 -0
  88. package/dist/commands/records/registry.js +227 -0
  89. package/dist/commands/records/registry.js.map +1 -0
  90. package/dist/commands/records/resolve.d.ts +14 -0
  91. package/dist/commands/records/resolve.d.ts.map +1 -0
  92. package/dist/commands/records/resolve.js +61 -0
  93. package/dist/commands/records/resolve.js.map +1 -0
  94. package/dist/commands/records/runner.d.ts +25 -0
  95. package/dist/commands/records/runner.d.ts.map +1 -0
  96. package/dist/commands/records/runner.js +224 -0
  97. package/dist/commands/records/runner.js.map +1 -0
  98. package/dist/index.d.ts +2 -0
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +2 -0
  101. package/dist/index.js.map +1 -1
  102. package/package.json +3 -3
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: blm-glo
3
+ description: Search Bureau of Land Management General Land Office (GLO) Records for federal land patents (Homestead, Cash Entry, Military Warrant) by patentee name or township/range/section, download the original patent image, and use the patent's legal description to request the underlying land-entry case file from NARA. Skill-only (no CLI): the GLO site has no public API. Use when tracing a federal land purchase, homestead, or migration, or pinning a family to a parcel.
4
+ ---
5
+
6
+ # BLM GLO Records (General Land Office)
7
+
8
+ **Skill-only: there is no CLI for this source.** See "Why no CLI" below. All work goes through the website at `https://glorecords.blm.gov/`.
9
+
10
+ - **What it holds:** federal land patents, the first transfer of public land from the U.S. government to a private owner, from 1788 to the present: more than five million title records, plus survey plats, field notes, land status records, and control document index records. Patent types include Cash Entry, Homestead, and Military Warrant.
11
+ - **What a patent gives you:** patentee name (plus assignee, warrantee, widow, or heir where applicable), issue (signature) date, acreage, the authority under which the land was taken (e.g. Homestead Act), the full legal land description (state, meridian, township, range, section, aliquot parts), the land office, and the document/accession number.
12
+ - **Coverage limit:** the site indexes only patented or completed land entries. It does not index cancelled entries or expired leases, and it does not contain every federal title record issued. The original 13 states, Vermont, Kentucky, Tennessee, Maine, West Virginia, Texas, and Hawaii are not public-land states: their early land records are state records, not GLO patents.
13
+ - **Access:** no account is needed for general searching. A Login.gov account is only needed to save searches.
14
+
15
+ ## Website search (verified live 2026-11-24)
16
+
17
+ The site was rebuilt and relaunched July 13, 2026 as the "GLO Portal" (Salesforce-based). Worked steps on the new site, per BLM's own help pages:
18
+
19
+ 1. Go to `https://glorecords.blm.gov/` and choose **Search Documents**, then **Patents**.
20
+ 2. Search by **name** (last name alone often works best; try spelling variants) or by **legal description**: state, principal meridian, township, range, and section. Enter township and range as three-digit numbers (e.g. township `009`, range `002`). A section search lists every patent ever issued in that section.
21
+ 3. **Ohio:** the map search does not currently work for Ohio records. Use **Advanced Search**: on the General tab choose Ohio (click update), add a county if known, and enter the name (in quotation marks for an exact name).
22
+ 4. Open a result to the Patent Details page. Download/print the patent image: it shows the patentee, date, acreage, authority, and full legal description. The details page also shows the section on a current map.
23
+ 5. Cite the patent by **accession/document number, state, and signature date**. Do not cite a glorecords.blm.gov URL: old record links died in the July 2026 rebuild and now land on the portal home page.
24
+
25
+ ### Search tips
26
+
27
+ - Search the surname alone first, then narrow by state/county; exact-name search (quotes) helps once you know the spelling the index uses.
28
+ - The `%` wildcard worked on the old site's patent search; it is not verified on the new portal, so treat wildcard behavior as unconfirmed.
29
+ - If no patent appears, the ancestor may have bought from a private party (second or later transfer, recorded at the county, not the GLO), taken land under a state grant, or had a cancelled entry (not indexed). Check county deed books next.
30
+
31
+ ## From the patent to the NARA case file
32
+
33
+ The patent is the end of the process. The underlying land-entry case file, held by the National Archives (Record Group 49, Records of the Bureau of Land Management, at Archives 1 in Washington, DC), holds the application and, for a homestead, proof of residence, witnesses, and citizenship papers. Request it on **NATF Form 84** (see the NARA "Accessing Land Entry Records" page, `https://www.archives.gov/research/land/accessing-land-entry-files`):
34
+
35
+ - **Pre-July 1908 homestead claims:** give the homesteader's name, the state, the approximate date of entry, and *either* the legal description *or* the land office name plus the land entry file number. The legal description and land office come from the GLO patent. (Exception: Kansas, Nebraska, and Oklahoma file numbers are not on the GLO site.)
36
+ - **Post-July 1908 claims:** give the name, the state, and the approximate date of entry. Files are arranged numerically by patent number.
37
+ - **Already digitized:** homestead case files completed by 1908 for Alaska, Arizona, Indiana, Illinois, Iowa, Nebraska, Nevada, Ohio, Utah, and Wyoming are searchable free through Homestead National Historical Park / the University of Nebraska-Lincoln / Family History Centers, and on Fold3 and Ancestry with a subscription. All other case files must be requested from NARA.
38
+ - Use the `nara-catalog-search` skill to check whether a file (or its series) is already digitized in the National Archives Catalog before ordering.
39
+
40
+ ## Why no CLI (verified live 2026-11-24)
41
+
42
+ - The old GLO reference documentation (`glorecords.blm.gov/reference/default.aspx`, including the "Web Services and Bulk Data" section) now returns the new portal's single-page-app shell; the documented SOAP web services and the bulk-data downloads (`/BulkData/default.aspx`, now 401) are gone with the July 2026 rebuild.
43
+ - The portal's backend host `glo-entry-prod.blm.gov` returns 418 at its root and exposes no documented public API. No public API, WSDL, or stable search-URL pattern was found.
44
+ - Old search URLs (`/search/default.aspx`) redirect to the portal home (`/s/`). There is no verified machine interface to build a CLI against, so this skill ships website-only rather than inventing endpoints.
45
+
46
+ ## Environment variables
47
+
48
+ - None. No key or account is needed for searching.
49
+
50
+ ## Research workflow notes
51
+
52
+ - Record the exact township, range, and section from every patent: that triple is what NARA needs for the case file, and it is what pins the parcel on a modern map.
53
+ - Public-land states (such as Illinois, Missouri, Michigan, and Kansas) typically show early purchases as Cash Entry, Homestead, or Military Warrant patents. California land is trickier: much of it passed through Spanish or Mexican ranchos and state grants rather than federal patents, so a missing GLO patent in California is expected and is not evidence of no land.
54
+ - Pair each patent with a GNIS lookup (see the `usgs-gnis` skill) for the modern place name and coordinates of the township's features.
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: california-archives
3
+ description: Research historical and genealogical records in California archives: the Online Archive of California (OAC) finding aids, Calisphere digitized items, the California State Archives catalog (Minerva), the California Archives Search Portal and exhibits, and the California Digital Newspaper Collection (CDNC). Gives the verified portal URLs, what is genuinely searchable online versus in-person only, and the bundled `ca-archives` CLI. Use when tracing ancestors in California, finding county collections, land-grant and probate records, digitized photographs, or California newspaper mentions.
4
+ ---
5
+
6
+ # California Archives
7
+
8
+ This skill covers California repositories for historical and family-history research across finding aids, digitized photographs, state archive catalogs, and historical newspapers.
9
+
10
+ It includes a standalone executable Python CLI at `skills/california-archives/scripts/ca-archives` using a PEP 723 `#!/usr/bin/env -S uv run --script` shebang with inline dependencies (`click`, `httpx`, `playwright`). No virtualenv setup or API key is required. The CLI needs a Chromium/Chrome executable for the two browser sources (auto-detected as `chromium`, `chromium-browser`, `google-chrome`, or `google-chrome-stable`; override with `CA_ARCHIVES_BROWSER`).
11
+
12
+ No account or API key is needed to search any source in this skill. Fees apply only to ordering copies, noted per source.
13
+
14
+ ## Bundled CLI (`scripts/ca-archives`)
15
+
16
+ ```bash
17
+ # Search all four machine-searchable sources (OAC and Calisphere share one browser session)
18
+ skills/california-archives/scripts/ca-archives search "Samuel Clemens" --limit 5
19
+
20
+ # Search a surname across every source
21
+ skills/california-archives/scripts/ca-archives search Lincoln --limit 3
22
+
23
+ # Only the plain-HTTP sources (fast, no browser)
24
+ skills/california-archives/scripts/ca-archives search Sacramento --source portal --source exhibits --limit 3
25
+
26
+ # JSON output
27
+ skills/california-archives/scripts/ca-archives search Sacramento --json
28
+
29
+ # Print verified search URLs without running any search (includes CDNC and Minerva)
30
+ skills/california-archives/scripts/ca-archives url "Clara Barton"
31
+
32
+ # Inspect one item found by search
33
+ skills/california-archives/scripts/ca-archives get --portal <portal-id>
34
+ skills/california-archives/scripts/ca-archives get --exhibits <exhibits-id>
35
+ ```
36
+
37
+ ## Verification log (verified live 2026-11-24)
38
+
39
+ - OAC home page `oac.cdlib.org/` returns 200. Its search page `https://oac.cdlib.org/search?q=<query>` returns an AWS WAF JavaScript challenge (HTTP 202, empty body) to plain curl, but loads and returns real results in headless Chromium. The `q` parameter is the search form's own field (verified in the home-page form markup).
40
+ - Calisphere home page `calisphere.org/` returns 200. Its search page `https://calisphere.org/search/?q=<query>` also intermittently returns the WAF challenge (HTTP 202, empty body) to plain curl, but loads in headless Chromium. The `q` parameter is the search form's own field.
41
+ - California State Archives pages `sos.ca.gov/archives`, `/archives/collections`, and `/archives/collections/minerva` all returned 200. The Minerva launch URL below was extracted from the Collections Overview page and itself returned 200.
42
+ - California Archives Search Portal `archives.sos.ca.gov/` returns 200. Search URL `https://archives.sos.ca.gov/Items?SearchText=<query>` returns `"Search Results X to Y of N"` with titled `/Items/Details/<id>` links.
43
+ - Archives exhibits Omeka S API `https://exhibits.sos.ca.gov/api/items?search=Sacramento&per_page=3` returned 200 `application/ld+json` with real items. The API base is the Omeka S site linked from the Portal home page.
44
+ - CDNC `cdnc.ucr.edu/` and its Veridian search URL return HTTP 403 with a Cloudflare "Just a moment..." challenge to plain curl, and the same challenge page in headless Chromium even with automation flags. CDNC is therefore URL-builder only in this skill (see below); no CDNC search result has been verified live end to end.
45
+ - Minerva search runs inside a GenCat (Minisis) web app reached through the launch URL; its search is a POST/JS flow and no machine search route was verified, so Minerva is launch-URL only in this skill.
46
+
47
+ ## Sources and their machine interfaces
48
+
49
+ ### Online Archive of California (OAC)
50
+
51
+ Portal: https://oac.cdlib.org/
52
+ Search URL: `https://oac.cdlib.org/search?q=<query>` (browser only, see verification log)
53
+
54
+ OAC, run by the California Digital Library, provides free public access to detailed descriptions of primary-source collections (finding aids) held by more than 200 contributing institutions throughout California. It is a finding-aid database, not a records database. A search returns collection guides that describe what an institution holds and how to request it; it does not usually return the digitized record itself. Search results can be viewed grouped by collection or as all results. Clicking a result opens the collection guide, which gives the contents, the holding institution, and a Request Item link that goes to that institution's own request page. The CLI labels each hit `[collection]` or `[component]`: a component is one folder or series inside a collection guide (its URL carries an `_aspace_` suffix), and the collection hit is the guide itself. Record the collection title, the holding institution, and the collection identifier (the `ark:/13030/...` in the guide URL); that is the citation you use to request the boxes. No account is needed to search OAC; the holding institution may ask you to create a free account to request material.
55
+
56
+ Do not rely on the older `search.findingaid.html` address that appears in California Secretary of State press releases; it was not verified as the current search route.
57
+
58
+ ### Calisphere
59
+
60
+ Portal: https://calisphere.org/
61
+ Search URL: `https://calisphere.org/search/?q=<query>` (browser only, see verification log)
62
+
63
+ Calisphere, a service of the UC Libraries powered by the California Digital Library, searches over two million digitized items (photographs, documents, ephemera) contributed by California libraries, archives, and museums. Unlike OAC it returns the digitized items themselves, with thumbnails, contributing institution, and collection. A hit gives an item page at `https://calisphere.org/item/<uuid>/`. Use it for photographs and local-history ephemera: a town street scene, a school photo, or an agricultural or ranch image. The CLI reports the total ("N item(s) found") and the item titles with links.
64
+
65
+ ### California State Archives: Minerva
66
+
67
+ Portal: https://www.sos.ca.gov/archives
68
+ Collections overview: https://www.sos.ca.gov/archives/collections
69
+ Family history resources: https://www.sos.ca.gov/archives/collections/family-history-resources
70
+ Minerva launch URL (verified 200, 2026-11-24): `https://gencat.sos.ca.gov/webcat/request/DoMenuRequest?SystemName=California+State+Archives&UserName=csa+public&Password=&TemplateProcessID=6000_3355&bCachable=1&MenuName=Minerva+Online+Catalog`
71
+ Address: 1500 11th Street, Sacramento, CA 95814. Phone 916-653-6814.
72
+
73
+ Minerva is the Archives' online catalog: search descriptions of the collections, organized by state agency. Open the launch URL in a browser and use its search box (basic or advanced); the CLI's `url` command prints the launch URL but cannot search Minerva itself. The Archives holds over 105,000 cubic feet of records: millions of documents and bound volumes, 20,000 maps and architectural drawings, 250,000 photographs, and 7,500 video and audio tapes.
74
+
75
+ ### California Archives Search Portal and exhibits
76
+
77
+ Portal: https://archives.sos.ca.gov/
78
+ Search URL: `https://archives.sos.ca.gov/Items?SearchText=<query>` (plain HTTP, CLI `search --source portal`)
79
+ Exhibits API: `https://exhibits.sos.ca.gov/api/items?search=<query>&per_page=<n>` (plain HTTP, CLI `search --source exhibits`)
80
+
81
+ The Portal is the Archives' newer search tool over its digital collections and exhibits, currently using data from Omeka S. Use it for digitized photographs and exhibits; the CLI parses the "Search Results X to Y of N" count and the titled item links. The exhibits site is the Omeka S front end behind the Portal; its public JSON-LD API is the only true API in this skill, and the CLI uses it directly. An exhibits item page is `https://exhibits.sos.ca.gov/s/exhibits/item/<id>`.
82
+
83
+ ### California Digital Newspaper Collection (CDNC)
84
+
85
+ Portal: https://cdnc.ucr.edu/cgi-bin/cdnc
86
+ Search URL (browser only, not verified end to end): `https://cdnc.ucr.edu/cgi-bin/cdnc?a=q&r=1&results=1&txq=<query>&e=-------en--20--1--txt-txIN-------`
87
+
88
+ CDNC, at UC Riverside's Center for Bibliographical Studies and Research, is a text-searchable collection of historical California newspapers from 1846 to the present, including the Californian and the Daily Alta California, plus current papers collected as PDFs. It is free to use; pre-1930 papers are in the public domain. The search URL pattern is the site's Veridian search form (`a=q`, `txq` = query text, the `e=` value = all years, English, 20 results per page), corroborated by published CDNC result URLs. It is a URL builder only: Cloudflare's bot challenge blocks both curl and headless Chromium (verified 2026-11-24), so open the URL the CLI prints in a real browser and run the search there. The CLI never claims a CDNC search succeeded. Use CDNC for obituaries, marriage and death notices, and local news.
89
+
90
+ ## What is searchable online versus in-person
91
+
92
+ - Online: catalog descriptions (Minerva), finding aids (OAC), digitized photographs and exhibits (Search Portal and exhibits API), digitized items (Calisphere), newspapers (CDNC, browser only), and the Disenos Collection of Spanish and Mexican land-grant maps (linked from the Archives collections pages; verify the link from the Collections page if it moves).
93
+ - In-person or by reference request: the county records themselves (probate case files, wills, naturalizations, deeds, homesteads, vital records for the 28 counties, 1850-1987), census schedules (1852 state, 1860 and 1880 federal, filed alphabetically by county with indexes), and state agency collections. Per Government Code section 12237, records 75 years or older from the date of last activity are open to the public; younger records containing personal, medical, employment, or correctional information are restricted.
94
+ - State agency collections of interest to genealogists: California National Guard 1849-1942, Folsom and San Quentin Prisons 1850-1945, early California Youth Authority 1891-1932, Yountville Veterans' Home Registers 1884-1910, and professional and vocational licensing boards 1885-1968. Also Spanish and Mexican Land Grants, court records, and the Root Cellar-Sacramento Genealogical Society library housed at the Archives.
95
+ - The Archives is not the official repository for California vital records; those are kept by the county and the California Department of Public Health. The Archives does hold some vital records from 28 counties as microfilmed copies and originals, including probate, marriage, birth, death, and naturalization records. Check the Local Government Records inventory on the Archives site for whether a target county and which record types are among the 28; do not assume a county is covered.
96
+
97
+ ## Research workflow
98
+
99
+ Worked order for tracing a person or family in a California county:
100
+
101
+ 1. Check Minerva for State Archives collections naming the county or locality.
102
+ 2. Search OAC for finding aids from county repositories and university special collections (such as the Bancroft Library).
103
+ 3. Search Calisphere and the Search Portal for digitized photographs and local ephemera.
104
+ 4. Search CDNC in a browser for obituaries, marriage notices, and local newspaper mentions.
105
+ 5. Check the Local Government Records inventory to see whether the county's probate, deed, or vital records are among the Archives' 28 counties. California vital records themselves come from the county recorder or the Department of Public Health, not the State Archives. For early land titles, check the Spanish and Mexican Land Grants collection and county deed records; use the 1852 state census and 1860/1880 federal schedules at the Archives to track households between censuses.
106
+
107
+ ## How to use this skill
108
+
109
+ 1. Pick the source for the record type: finding aid (OAC), digitized item or photo (Calisphere, Portal, exhibits), catalog description (Minerva), newspaper (CDNC).
110
+ 2. Run the CLI search first; it is faster than clicking through four portals and gives totals per source.
111
+ 3. For CDNC and Minerva, use `ca-archives url <query>` and search in the browser.
112
+ 4. Record the repository, collection, and exact citation (collection identifier, Portal item ID, Calisphere item UUID, or CDNC paper/date/page) in `data/`. Portals rename and redesign; the citation is what survives. An index hit is not the record: order the copy or plan the visit as the section above says.
113
+ 5. When a portal has no online index for the record you need, check the subscription indexes named on the state pages (FamilySearch, Ancestry) before assuming the record is visit-only. The state page usually says which one holds the digitized copy.
114
+
115
+ ## What this skill does not cover
116
+
117
+ - Federal records (census, military service and pension files at NARA). Use the `nara-catalog-search` skill for those.
118
+ - Subscription indexes (Ancestry, FamilySearch, MyHeritage). They are named above only where a state portal itself points to them as the holder of a digitized copy.
119
+ - County courthouses and county historical societies. County records are usually the follow-up once a state index gives a book and page.
120
+ - No public, key-free API was verified live for OAC, Calisphere, the Portal, Minerva, or CDNC on 2026-11-24. Do not invent one. The exhibits Omeka S API is the only API in this skill.
@@ -0,0 +1,373 @@
1
+ #!/usr/bin/env -S uv run --script
2
+ # /// script
3
+ # requires-python = ">=3.11"
4
+ # dependencies = [
5
+ # "click>=8.1",
6
+ # "httpx>=0.27",
7
+ # "playwright>=1.49",
8
+ # ]
9
+ # ///
10
+ """Search California archives portals: OAC, Calisphere, the California
11
+ Archives Search Portal, the Archives exhibits (Omeka S API), plus
12
+ search-URL builders for CDNC and Minerva.
13
+
14
+ Machine interfaces verified live 2026-11-24 (see the
15
+ california-archives SKILL.md). No account or API key is needed for any
16
+ source. OAC and Calisphere sit behind a bot challenge that plain HTTP
17
+ cannot pass, so those two run through headless Chromium; the Portal and
18
+ the exhibits API answer plain HTTPS directly. CDNC is behind a
19
+ Cloudflare challenge even headless Chromium cannot pass, and Minerva
20
+ is a POST/JS catalog with no verified machine search route, so those
21
+ two are URL builders only (see the `url` command).
22
+ """
23
+
24
+ from __future__ import annotations
25
+
26
+ import json
27
+ import os
28
+ import re
29
+ import shutil
30
+ import sys
31
+ from html.parser import HTMLParser
32
+ from pathlib import Path
33
+ from urllib.parse import quote, urlencode
34
+
35
+ import click
36
+ import httpx
37
+
38
+ OAC_BASE = "https://oac.cdlib.org"
39
+ CALISPHERE_BASE = "https://calisphere.org"
40
+ PORTAL_BASE = "https://archives.sos.ca.gov"
41
+ EXHIBITS_BASE = "https://exhibits.sos.ca.gov"
42
+ CDNC_BASE = "https://cdnc.ucr.edu/cgi-bin/cdnc"
43
+ MINERVA_URL = (
44
+ "https://gencat.sos.ca.gov/webcat/request/DoMenuRequest"
45
+ "?SystemName=California+State+Archives&UserName=csa+public&Password="
46
+ "&TemplateProcessID=6000_3355&bCachable=1&MenuName=Minerva+Online+Catalog"
47
+ )
48
+ USER_AGENT = (
49
+ "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 "
50
+ "(KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
51
+ )
52
+ SEARCHABLE = ("oac", "calisphere", "portal", "exhibits")
53
+ ALL_SOURCES = SEARCHABLE + ("cdnc", "minerva")
54
+
55
+
56
+ def find_browser_executable():
57
+ env_exe = os.environ.get("CA_ARCHIVES_BROWSER")
58
+ if env_exe and Path(env_exe).exists():
59
+ return env_exe
60
+ for candidate in ("chromium", "chromium-browser", "google-chrome", "google-chrome-stable"):
61
+ found = shutil.which(candidate)
62
+ if found:
63
+ return found
64
+ return None
65
+
66
+
67
+ def oac_url(query):
68
+ return OAC_BASE + "/search?" + urlencode({"q": query}, quote_via=quote)
69
+
70
+
71
+ def calisphere_url(query):
72
+ return CALISPHERE_BASE + "/search/?" + urlencode({"q": query}, quote_via=quote)
73
+
74
+
75
+ def portal_url(query):
76
+ return PORTAL_BASE + "/Items?" + urlencode({"SearchText": query}, quote_via=quote)
77
+
78
+
79
+ def exhibits_url(query, limit=10):
80
+ return EXHIBITS_BASE + "/api/items?" + urlencode(
81
+ {"search": query, "per_page": str(limit)}, quote_via=quote
82
+ )
83
+
84
+
85
+ def cdnc_url(query):
86
+ # Veridian search URL; pattern corroborated by published CDNC result
87
+ # URLs. The e= value selects all years, English, 20 results per page.
88
+ return CDNC_BASE + "?a=q&r=1&results=1&txq=" + quote(query) + "&e=-------en--20--1--txt-txIN-------"
89
+
90
+
91
+ def build_url(source, query, limit=10):
92
+ builders = {
93
+ "oac": lambda: oac_url(query),
94
+ "calisphere": lambda: calisphere_url(query),
95
+ "portal": lambda: portal_url(query),
96
+ "exhibits": lambda: exhibits_url(query, limit),
97
+ "cdnc": lambda: cdnc_url(query),
98
+ "minerva": lambda: MINERVA_URL,
99
+ }
100
+ return builders[source]()
101
+
102
+ class PortalLinkParser(HTMLParser):
103
+ """Collect titled links to /Items/Details/<id> from a Portal results page."""
104
+
105
+ def __init__(self):
106
+ super().__init__(convert_charrefs=True)
107
+ self.results = []
108
+ self._href = None
109
+ self._text = []
110
+
111
+ def handle_starttag(self, tag, attrs):
112
+ if tag == "a":
113
+ href = dict(attrs).get("href", "")
114
+ m = re.match(r"/Items/Details/(\d+)$", href)
115
+ if m:
116
+ self._href = (m.group(1), href)
117
+ self._text = []
118
+
119
+ def handle_data(self, data):
120
+ if self._href is not None:
121
+ self._text.append(data)
122
+
123
+ def handle_endtag(self, tag):
124
+ if tag == "a" and self._href is not None:
125
+ title = " ".join("".join(self._text).split())
126
+ if title:
127
+ item_id, href = self._href
128
+ if not any(r["id"] == item_id for r in self.results):
129
+ self.results.append({"id": item_id, "title": title, "url": PORTAL_BASE + href})
130
+ self._href = None
131
+ self._text = []
132
+
133
+
134
+ def search_portal(query, limit=10):
135
+ url = portal_url(query)
136
+ with httpx.Client(timeout=30.0, follow_redirects=True, headers={"User-Agent": USER_AGENT}) as client:
137
+ resp = client.get(url)
138
+ resp.raise_for_status()
139
+ html = resp.text
140
+ total = None
141
+ m = re.search(r"Search Results \d+ to \d+ of (\d+)", html)
142
+ if m:
143
+ total = int(m.group(1))
144
+ parser = PortalLinkParser()
145
+ parser.feed(html)
146
+ return {"source": "portal", "url": url, "total": total, "results": parser.results[:limit]}
147
+
148
+
149
+ def _omeka_title(item):
150
+ title = item.get("o:title")
151
+ if title:
152
+ return title
153
+ vals = item.get("dcterms:title", [])
154
+ if vals and isinstance(vals, list) and vals[0].get("@value"):
155
+ return vals[0]["@value"]
156
+ return "(untitled)"
157
+
158
+
159
+ def search_exhibits(query, limit=10):
160
+ url = exhibits_url(query, limit)
161
+ with httpx.Client(timeout=30.0, follow_redirects=True, headers={"User-Agent": USER_AGENT}) as client:
162
+ resp = client.get(url, headers={"Accept": "application/ld+json"})
163
+ resp.raise_for_status()
164
+ items = resp.json()
165
+ hdr = resp.headers.get("Omeka-S-Total-Results")
166
+ total = int(hdr) if hdr else (len(items) if isinstance(items, list) else 0)
167
+ results = []
168
+ for item in items if isinstance(items, list) else []:
169
+ item_id = item.get("o:id")
170
+ types = item.get("@type", [])
171
+ results.append({
172
+ "id": str(item_id),
173
+ "title": _omeka_title(item),
174
+ "type": ", ".join(t for t in types if t != "o:Item"),
175
+ "url": EXHIBITS_BASE + "/s/exhibits/item/" + str(item_id),
176
+ })
177
+ return {"source": "exhibits", "url": url, "total": total, "results": results}
178
+
179
+ OAC_LINKS_JS = """() => Array.from(document.querySelectorAll('a[href*="/findaid/"]')).map(a => ({href: a.getAttribute('href'), text: a.textContent.trim().replace(/\\s+/g, ' ').slice(0, 160)}))"""
180
+ CAL_LINKS_JS = """() => Array.from(document.querySelectorAll('a[href*="/item/"]')).map(a => ({href: a.getAttribute('href'), text: a.textContent.trim().replace(/\\s+/g, ' ').slice(0, 160)}))"""
181
+
182
+
183
+ def _dedupe_links(links, base, limit):
184
+ seen = set()
185
+ results = []
186
+ for link in links:
187
+ href = link.get("href", "")
188
+ text = (link.get("text") or "").strip()
189
+ if not href or not text or href in seen:
190
+ continue
191
+ seen.add(href)
192
+ kind = "component" if "_aspace_" in href else "collection"
193
+ results.append({"title": text, "url": base + href, "kind": kind})
194
+ if len(results) >= limit:
195
+ break
196
+ return results
197
+
198
+
199
+ def browser_search(sources, query, limit=10, timeout_ms=60000):
200
+ """Search OAC and/or Calisphere sharing one headless Chromium session."""
201
+ from playwright.sync_api import sync_playwright
202
+
203
+ exe = find_browser_executable()
204
+ if exe is None:
205
+ raise click.ClickException("No Chromium/Chrome executable found; set CA_ARCHIVES_BROWSER.")
206
+ out = {}
207
+ with sync_playwright() as pw:
208
+ browser = pw.chromium.launch(headless=True, executable_path=exe, args=["--no-sandbox"])
209
+ page = browser.new_page(user_agent=USER_AGENT)
210
+ try:
211
+ if "oac" in sources:
212
+ url = oac_url(query)
213
+ page.goto(url, wait_until="domcontentloaded", timeout=timeout_ms)
214
+ try:
215
+ page.wait_for_function(
216
+ "() => /of \\d+ entries|No results/i.test(document.body.innerText)",
217
+ timeout=20000,
218
+ )
219
+ except Exception:
220
+ pass
221
+ page.wait_for_timeout(500)
222
+ text = page.evaluate("document.body.innerText")
223
+ m = re.search(r"of (\d+) entries", text)
224
+ total = int(m.group(1)) if m else None
225
+ links = page.evaluate(OAC_LINKS_JS)
226
+ out["oac"] = {"source": "oac", "url": url, "total": total,
227
+ "results": _dedupe_links(links, OAC_BASE, limit)}
228
+ if "calisphere" in sources:
229
+ url = calisphere_url(query)
230
+ page.goto(url, wait_until="domcontentloaded", timeout=timeout_ms)
231
+ try:
232
+ page.wait_for_function(
233
+ "() => /\\d+ items? found|No results/i.test(document.body.innerText)",
234
+ timeout=20000,
235
+ )
236
+ except Exception:
237
+ pass
238
+ page.wait_for_timeout(500)
239
+ text = page.evaluate("document.body.innerText")
240
+ m = re.search(r"(\d+) items? found", text)
241
+ total = int(m.group(1)) if m else None
242
+ links = page.evaluate(CAL_LINKS_JS)
243
+ results = []
244
+ for link in links:
245
+ href = link.get("href", "")
246
+ title = (link.get("text") or "").strip()
247
+ if not href.startswith("/item/") or not title:
248
+ continue
249
+ if any(r["url"] == CALISPHERE_BASE + href for r in results):
250
+ continue
251
+ results.append({"title": title, "url": CALISPHERE_BASE + href})
252
+ if len(results) >= limit:
253
+ break
254
+ out["calisphere"] = {"source": "calisphere", "url": url, "total": total, "results": results}
255
+ finally:
256
+ browser.close()
257
+ return out
258
+
259
+
260
+ def _print_source(entry, limit_note=True):
261
+ total = entry.get("total")
262
+ shown = len(entry["results"])
263
+ header = entry["source"]
264
+ if total is not None:
265
+ header += " (%d total" % total
266
+ header += ", showing %d" % shown if shown != total else ")"
267
+ if shown != total:
268
+ header += ")"
269
+ else:
270
+ header += " (showing %d)" % shown
271
+ click.echo(header)
272
+ click.echo(" " + entry["url"])
273
+ if not entry["results"]:
274
+ click.echo(" No results.")
275
+ for i, r in enumerate(entry["results"], 1):
276
+ line = " %d. %s" % (i, r["title"])
277
+ if r.get("kind"):
278
+ line += " [%s]" % r["kind"]
279
+ if r.get("type"):
280
+ line += " (%s)" % r["type"]
281
+ click.echo(line)
282
+ click.echo(" " + r["url"])
283
+
284
+
285
+ @click.group()
286
+ def cli():
287
+ """Search California archives portals (OAC, Calisphere, State Archives)."""
288
+
289
+
290
+ @cli.command()
291
+ @click.argument("query", nargs=-1, required=True)
292
+ @click.option("--source", "sources", multiple=True, type=click.Choice(SEARCHABLE),
293
+ help="Only search this source (repeatable). Default: all four.")
294
+ @click.option("--limit", default=10, show_default=True, help="Results per source.")
295
+ @click.option("--json", "as_json", is_flag=True, help="Emit JSON instead of text.")
296
+ def search(query, sources, limit, as_json):
297
+ """Search the California archives portals for QUERY."""
298
+ q = " ".join(query)
299
+ wanted = list(sources) if sources else list(SEARCHABLE)
300
+ browser_sources = [s for s in wanted if s in ("oac", "calisphere")]
301
+ out = {}
302
+ if browser_sources:
303
+ out.update(browser_search(browser_sources, q, limit))
304
+ if "portal" in wanted:
305
+ out["portal"] = search_portal(q, limit)
306
+ if "exhibits" in wanted:
307
+ out["exhibits"] = search_exhibits(q, limit)
308
+ ordered = [out[s] for s in wanted if s in out]
309
+ if as_json:
310
+ click.echo(json.dumps({"query": q, "sources": ordered}, indent=2))
311
+ return
312
+ for entry in ordered:
313
+ _print_source(entry)
314
+ click.echo("")
315
+
316
+
317
+ @cli.command()
318
+ @click.argument("query", nargs=-1, required=True)
319
+ @click.option("--source", "sources", multiple=True, type=click.Choice(ALL_SOURCES),
320
+ help="Only print URLs for this source (repeatable). Default: all six.")
321
+ def url(query, sources):
322
+ """Print verified search URLs for QUERY without running any search."""
323
+ q = " ".join(query)
324
+ wanted = list(sources) if sources else list(ALL_SOURCES)
325
+ for s in wanted:
326
+ click.echo("%s: %s" % (s, build_url(s, q)))
327
+ if "cdnc" in wanted:
328
+ click.echo("note: CDNC is behind a Cloudflare challenge; open the URL in a browser.")
329
+ if "minerva" in wanted:
330
+ click.echo("note: Minerva is a catalog you search in the browser; this is its launch URL.")
331
+
332
+
333
+ @cli.command()
334
+ @click.option("--portal", "portal_id", default=None, help="Portal item ID (from search results).")
335
+ @click.option("--exhibits", "exhibits_id", default=None, help="Exhibits item ID (from search results).")
336
+ @click.option("--json", "as_json", is_flag=True, help="Emit JSON instead of text.")
337
+ def get(portal_id, exhibits_id, as_json):
338
+ """Fetch one Portal or exhibits item by ID."""
339
+ if bool(portal_id) == bool(exhibits_id):
340
+ raise click.UsageError("Pass exactly one of --portal ID or --exhibits ID.")
341
+ if portal_id:
342
+ url = PORTAL_BASE + "/Items/Details/" + portal_id
343
+ with httpx.Client(timeout=30.0, follow_redirects=True, headers={"User-Agent": USER_AGENT}) as client:
344
+ resp = client.get(url)
345
+ resp.raise_for_status()
346
+ m = re.search(r"<title>([^<]+)</title>", resp.text)
347
+ title = (m.group(1).strip() if m else "(no title)").replace(" | California Archives Search", "")
348
+ data = {"source": "portal", "id": portal_id, "title": title, "url": url}
349
+ else:
350
+ url = EXHIBITS_BASE + "/api/items/" + exhibits_id
351
+ with httpx.Client(timeout=30.0, follow_redirects=True, headers={"User-Agent": USER_AGENT}) as client:
352
+ resp = client.get(url, headers={"Accept": "application/ld+json"})
353
+ resp.raise_for_status()
354
+ item = resp.json()
355
+ desc = ""
356
+ for val in item.get("dcterms:description", []) or []:
357
+ if val.get("@value"):
358
+ desc = val["@value"]
359
+ break
360
+ data = {"source": "exhibits", "id": exhibits_id, "title": _omeka_title(item),
361
+ "type": ", ".join(t for t in item.get("@type", []) if t != "o:Item"),
362
+ "description": desc[:500],
363
+ "url": EXHIBITS_BASE + "/s/exhibits/item/" + exhibits_id}
364
+ if as_json:
365
+ click.echo(json.dumps(data, indent=2))
366
+ return
367
+ for key, val in data.items():
368
+ if val:
369
+ click.echo("%s: %s" % (key, val))
370
+
371
+
372
+ if __name__ == "__main__":
373
+ cli()